diff --git a/.gitignore b/.gitignore index 2e90e788faa..2b38063a0b7 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ scripts/buildProtocol.js scripts/ior.js scripts/authors.js scripts/configurePrerelease.js +scripts/open-user-pr.js scripts/processDiagnosticMessages.d.ts scripts/processDiagnosticMessages.js scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js diff --git a/.travis.yml b/.travis.yml index 8ec2411cea9..d7610ed7603 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ branches: - master - release-2.7 - release-2.8 + - release-2.9 install: - npm uninstall typescript --no-save diff --git a/Gulpfile.js b/Gulpfile.js index 08392070099..94f726b9a3a 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -55,7 +55,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), { debug: process.env.debug || process.env["debug-brk"] || process.env.d, inspect: process.env.inspect || process.env["inspect-brk"] || process.env.i, host: process.env.TYPESCRIPT_HOST || process.env.host || "node", - browser: process.env.browser || process.env.b || "IE", + browser: process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome"), timeout: process.env.timeout || 40000, tests: process.env.test || process.env.tests || process.env.t, runners: process.env.runners || process.env.runner || process.env.ru, @@ -161,7 +161,7 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag * 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg' * generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json */ -const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"] +const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"] .map(f => path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json")) .concat(generatedLCGFile); diff --git a/Jakefile.js b/Jakefile.js index 2eeccdd7a4f..5d85a4e74f3 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -131,7 +131,7 @@ var generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages * 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg' * generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json */ -var localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) { +var localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"].map(function (f) { return path.join(builtLocalDirectory, f); }).concat(path.dirname(generatedLCGFile)); @@ -922,7 +922,7 @@ desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is task("runtests-browser", ["browserify", nodeServerOutFile], function () { cleanTestDirs(); host = "node"; - var browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE"); + var browser = process.env.browser || process.env.b || (os.platform() === "win32" ? "edge" : "chrome"); var runners = process.env.runners || process.env.runner || process.env.ru; var tests = process.env.test || process.env.tests || process.env.t; var light = process.env.light || false; diff --git a/package-lock.json b/package-lock.json index 43128f91636..d60ec3b7545 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,11 @@ "integrity": "sha1-z6I7xYQPkQTOMqZedNt+epdLvuE=", "dev": true, "requires": { - "acorn": "^5.0.3", - "css": "^2.2.1", - "normalize-path": "^2.1.1", - "source-map": "^0.5.6", - "through2": "^2.0.3" + "acorn": "5.5.3", + "css": "2.2.1", + "normalize-path": "2.1.1", + "source-map": "0.5.7", + "through2": "2.0.3" }, "dependencies": { "acorn": { @@ -31,8 +31,41 @@ "integrity": "sha1-iQrnxdjId/bThIYCFazp1+yUW9o=", "dev": true, "requires": { - "normalize-path": "^2.0.1", - "through2": "^2.0.3" + "normalize-path": "2.1.1", + "through2": "2.0.3" + } + }, + "@octokit/rest": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-15.4.0.tgz", + "integrity": "sha512-cmDdt71Kufz0AZt/EPlJbce9NDhoc9ggJm9P7h6Y+WOds19Q6vBJAPApKTIpN4VpnvwB1XHEOdmqP7gZdPCNKw==", + "dev": true, + "requires": { + "before-after-hook": "1.1.0", + "btoa-lite": "1.0.0", + "debug": "3.1.0", + "http-proxy-agent": "2.1.0", + "https-proxy-agent": "2.2.1", + "lodash": "4.17.10", + "node-fetch": "2.1.2", + "url-template": "2.0.8" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + } } }, "@types/browserify": { @@ -41,8 +74,8 @@ "integrity": "sha512-mY6dYfq1Ns3Xqz/JFUcyoWaXtm0XDoNhkU1vCwM/ULM5zqNL+SbtacJhce/JCgPeCdbqdVqq77tJ4HwdtypSxg==", "dev": true, "requires": { - "@types/insert-module-globals": "*", - "@types/node": "*" + "@types/insert-module-globals": "7.0.0", + "@types/node": "8.5.5" } }, "@types/chai": { @@ -63,7 +96,7 @@ "integrity": "sha512-y6qRq6raBuu965clKgx6FHuiPu3oHdtmzMPXi8Uahsjdq1L6DL5fS/aY5/s71YwM7k6K1QIWvem5vNwlnNGIkQ==", "dev": true, "requires": { - "@types/glob": "*" + "@types/glob": "5.0.35" } }, "@types/events": { @@ -78,9 +111,9 @@ "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", "dev": true, "requires": { - "@types/events": "*", - "@types/minimatch": "*", - "@types/node": "*" + "@types/events": "1.2.0", + "@types/minimatch": "3.0.3", + "@types/node": "8.5.5" } }, "@types/gulp": { @@ -89,9 +122,9 @@ "integrity": "sha512-u6/zWPzYRNPAtvyFJ3/RSXjmBaBM1dVs5kW22/jU6J786ZGLfSndhLoNOpFI6FGQvqTA+QzFHjSMhpkAN+wxcQ==", "dev": true, "requires": { - "@types/node": "*", - "@types/orchestrator": "*", - "@types/vinyl": "*" + "@types/node": "8.5.5", + "@types/orchestrator": "0.3.2", + "@types/vinyl": "2.0.2" } }, "@types/gulp-concat": { @@ -100,7 +133,7 @@ "integrity": "sha512-CUCFADlITzzBfBa2bdGzhKtvBr4eFh+evb+4igVbvPoO5RyPfHifmyQlZl6lM7q19+OKncRlFXDU7B4X9Ayo2g==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/gulp-help": { @@ -109,9 +142,9 @@ "integrity": "sha512-MkW7psZznxxJg2MBk2P2qHE+T8jEZVFz3FG/qGjUYazkyJt7hBJWx5Nuewmay5RVNtUvSWPrdZLr/WTXY3T/6A==", "dev": true, "requires": { - "@types/gulp": "*", - "@types/node": "*", - "@types/orchestrator": "*" + "@types/gulp": "3.8.36", + "@types/node": "8.5.5", + "@types/orchestrator": "0.3.2" } }, "@types/gulp-newer": { @@ -120,7 +153,7 @@ "integrity": "sha512-e7J/Zv5Wd7CC0WpuA2syWVitgwrkG0u221e41w7r07XUR6hMH6kHPkq9tUrusHkbeW8QbuLbis5fODOwQCyggQ==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/gulp-sourcemaps": { @@ -129,7 +162,7 @@ "integrity": "sha512-+7BAmptW2bxyJnJcCEuie7vLoop3FwWgCdBMzyv7MYXED/HeNMeQuX7uPCkp4vfU1TTu4CYFH0IckNPvo0VePA==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/insert-module-globals": { @@ -138,7 +171,7 @@ "integrity": "sha512-zudCJPwluh1VUDB6Gl/OQdRp+fYy3+47huJB/JMQubMS2p+sH18MCVK4WUz3FqaWLB12yh5ELxVR/+tqwlm/qA==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/merge2": { @@ -147,7 +180,7 @@ "integrity": "sha512-GjaXY4OultxbaOOk7lCLO7xvEcFpdjExC605YmfI6X29vhHKpJfMWKCDZd3x+BITrZaXKg97DgV/SdGVSwdzxA==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/minimatch": { @@ -168,7 +201,7 @@ "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/mocha": { @@ -189,8 +222,8 @@ "integrity": "sha512-cKB4yTX0wGaRCSkdHDX2fkGQbMAA8UOshC2U7DQky1CE5o+5q2iQQ8VkbPbE/88uaTtsusvBPMcCX7dgmjxBhQ==", "dev": true, "requires": { - "@types/node": "*", - "@types/q": "*" + "@types/node": "8.5.5", + "@types/q": "1.5.0" } }, "@types/q": { @@ -205,8 +238,8 @@ "integrity": "sha512-XwGr1b4yCGUILKeBkzmeWcxmGHQ0vFFFpA6D6y1yLO6gKmYorF+PHqdU5KG+nWt38OvtrkDptmrSmlHX/XtpLw==", "dev": true, "requires": { - "@types/gulp": "*", - "@types/node": "*" + "@types/gulp": "3.8.36", + "@types/node": "8.5.5" } }, "@types/through2": { @@ -215,7 +248,7 @@ "integrity": "sha1-H/LoihAN+1sUDnu5h5HxGUQA0TE=", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/travis-fold": { @@ -230,7 +263,7 @@ "integrity": "sha512-2iYpNuOl98SrLPBZfEN9Mh2JCJ2EI9HU35SfgBEb51DcmaHkhp8cKMblYeBqMQiwXMgAD3W60DbQ4i/UdLiXhw==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "8.5.5" } }, "@types/xml2js": { @@ -239,17 +272,7 @@ "integrity": "sha512-8aKUBSj3oGcnuiBmDLm3BIk09RYg01mz9HlQ2u4aS17oJ25DxjQrEUVGFSBVNOfM45pQW4OjcBPplq6r/exJdA==", "dev": true, "requires": { - "@types/node": "*" - } - }, - "JSONStream": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", - "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo=", - "dev": true, - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" + "@types/node": "8.5.5" } }, "abbrev": { @@ -270,8 +293,8 @@ "integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==", "dev": true, "requires": { - "acorn": "^5.4.1", - "xtend": "^4.0.1" + "acorn": "5.5.3", + "xtend": "4.0.1" }, "dependencies": { "acorn": { @@ -282,15 +305,24 @@ } } }, + "agent-base": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.0.tgz", + "integrity": "sha512-c+R/U5X+2zz2+UCrCFv6odQzJdoqI+YecuhnAJLa1zYaMc13zPfwMwZrr91Pd1DYNo/yPRbiM4WVf9whgwFsIg==", + "dev": true, + "requires": { + "es6-promisify": "5.0.0" + } + }, "align-text": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" }, "dependencies": { "kind-of": { @@ -299,7 +331,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -316,7 +348,7 @@ "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { - "ansi-wrap": "^0.1.0" + "ansi-wrap": "0.1.0" } }, "ansi-cyan": { @@ -358,7 +390,7 @@ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "color-convert": "1.9.1" } }, "ansi-wrap": { @@ -373,7 +405,7 @@ "integrity": "sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE=", "dev": true, "requires": { - "buffer-equal": "^1.0.0" + "buffer-equal": "1.0.0" } }, "archy": { @@ -388,7 +420,7 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "sprintf-js": "~1.0.2" + "sprintf-js": "1.0.3" } }, "arr-diff": { @@ -451,7 +483,7 @@ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", "dev": true, "requires": { - "array-uniq": "^1.0.1" + "array-uniq": "1.0.3" } }, "array-uniq": { @@ -472,9 +504,9 @@ "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", "dev": true, "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "bn.js": "4.11.8", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" } }, "assert": { @@ -504,7 +536,7 @@ "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", "dev": true, "requires": { - "acorn": "^4.0.3" + "acorn": "4.0.13" } }, "async": { @@ -525,9 +557,9 @@ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" }, "dependencies": { "ansi-styles": { @@ -542,11 +574,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -569,13 +601,13 @@ "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.1", + "pascalcase": "0.1.1" }, "dependencies": { "define-property": { @@ -584,7 +616,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "is-descriptor": "1.0.2" } }, "is-accessor-descriptor": { @@ -593,7 +625,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-data-descriptor": { @@ -602,7 +634,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-descriptor": { @@ -611,9 +643,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" } } } @@ -630,6 +662,12 @@ "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", "dev": true }, + "before-after-hook": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.1.0.tgz", + "integrity": "sha512-VOMDtYPwLbIncTxNoSzRyvaMxtXmLWLUqr8k5AfC1BzLk34HvBXaQX8snOwQZ4c0aX8aSERqtJSiI9/m2u5kuA==", + "dev": true + }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -642,7 +680,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -652,16 +690,16 @@ "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", "dev": true, "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.2", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" }, "dependencies": { "extend-shallow": { @@ -670,7 +708,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } } } @@ -687,12 +725,12 @@ "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", "dev": true, "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "~0.8.0", - "defined": "^1.0.0", - "safe-buffer": "^5.1.1", - "through2": "^2.0.0", - "umd": "^3.0.0" + "combine-source-map": "0.8.0", + "defined": "1.0.0", + "JSONStream": "1.3.2", + "safe-buffer": "5.1.2", + "through2": "2.0.3", + "umd": "3.0.3" } }, "browser-resolve": { @@ -716,54 +754,54 @@ "integrity": "sha512-yotdAkp/ZbgDesHQBYU37zjc29JDH4iXT8hjzM1fdUVWogjARX0S1cKeX24Ci6zZ+jG+ADmCTRt6xvtmJnI+BQ==", "dev": true, "requires": { - "JSONStream": "^1.0.3", - "assert": "^1.4.0", - "browser-pack": "^6.0.1", - "browser-resolve": "^1.11.0", - "browserify-zlib": "~0.2.0", - "buffer": "^5.0.2", - "cached-path-relative": "^1.0.0", - "concat-stream": "^1.6.0", - "console-browserify": "^1.1.0", - "constants-browserify": "~1.0.0", - "crypto-browserify": "^3.0.0", - "defined": "^1.0.0", - "deps-sort": "^2.0.0", - "domain-browser": "^1.2.0", - "duplexer2": "~0.1.2", - "events": "^2.0.0", - "glob": "^7.1.0", - "has": "^1.0.0", - "htmlescape": "^1.1.0", - "https-browserify": "^1.0.0", - "inherits": "~2.0.1", - "insert-module-globals": "^7.0.0", - "labeled-stream-splicer": "^2.0.0", - "mkdirp": "^0.5.0", - "module-deps": "^6.0.0", - "os-browserify": "~0.3.0", - "parents": "^1.0.1", - "path-browserify": "~0.0.0", - "process": "~0.11.0", - "punycode": "^1.3.2", - "querystring-es3": "~0.2.0", - "read-only-stream": "^2.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.4", - "shasum": "^1.0.0", - "shell-quote": "^1.6.1", - "stream-browserify": "^2.0.0", - "stream-http": "^2.0.0", - "string_decoder": "^1.1.1", - "subarg": "^1.0.0", - "syntax-error": "^1.1.1", - "through2": "^2.0.0", - "timers-browserify": "^1.0.1", + "assert": "1.4.1", + "browser-pack": "6.1.0", + "browser-resolve": "1.11.2", + "browserify-zlib": "0.2.0", + "buffer": "5.1.0", + "cached-path-relative": "1.0.1", + "concat-stream": "1.6.2", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.12.0", + "defined": "1.0.0", + "deps-sort": "2.0.0", + "domain-browser": "1.2.0", + "duplexer2": "0.1.4", + "events": "2.0.0", + "glob": "7.1.2", + "has": "1.0.1", + "htmlescape": "1.1.1", + "https-browserify": "1.0.0", + "inherits": "2.0.3", + "insert-module-globals": "7.0.6", + "JSONStream": "1.3.2", + "labeled-stream-splicer": "2.0.1", + "mkdirp": "0.5.1", + "module-deps": "6.0.2", + "os-browserify": "0.3.0", + "parents": "1.0.1", + "path-browserify": "0.0.0", + "process": "0.11.10", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "read-only-stream": "2.0.0", + "readable-stream": "2.3.6", + "resolve": "1.1.7", + "shasum": "1.0.2", + "shell-quote": "1.6.1", + "stream-browserify": "2.0.1", + "stream-http": "2.8.1", + "string_decoder": "1.1.1", + "subarg": "1.0.0", + "syntax-error": "1.4.0", + "through2": "2.0.3", + "timers-browserify": "1.4.2", "tty-browserify": "0.0.1", - "url": "~0.11.0", - "util": "~0.10.1", - "vm-browserify": "^1.0.0", - "xtend": "^4.0.0" + "url": "0.11.0", + "util": "0.10.3", + "vm-browserify": "1.0.1", + "xtend": "4.0.1" } }, "browserify-aes": { @@ -772,12 +810,12 @@ "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "inherits": "2.0.3", + "safe-buffer": "5.1.2" } }, "browserify-cipher": { @@ -786,9 +824,9 @@ "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", "dev": true, "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" + "browserify-aes": "1.2.0", + "browserify-des": "1.0.1", + "evp_bytestokey": "1.0.3" } }, "browserify-des": { @@ -797,9 +835,9 @@ "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", "dev": true, "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1" + "cipher-base": "1.0.4", + "des.js": "1.0.0", + "inherits": "2.0.3" } }, "browserify-rsa": { @@ -808,8 +846,8 @@ "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" + "bn.js": "4.11.8", + "randombytes": "2.0.6" } }, "browserify-sign": { @@ -818,13 +856,13 @@ "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", "dev": true, "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "elliptic": "6.4.0", + "inherits": "2.0.3", + "parse-asn1": "5.1.1" } }, "browserify-zlib": { @@ -833,17 +871,23 @@ "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", "dev": true, "requires": { - "pako": "~1.0.5" + "pako": "1.0.6" } }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=", + "dev": true + }, "buffer": { "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.0.2", - "ieee754": "^1.1.4" + "base64-js": "1.3.0", + "ieee754": "1.1.11" } }, "buffer-crc32": { @@ -888,15 +932,15 @@ "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" } }, "cached-path-relative": { @@ -919,8 +963,8 @@ "dev": true, "optional": true, "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" + "align-text": "0.1.4", + "lazy-cache": "1.0.4" } }, "chai": { @@ -929,12 +973,12 @@ "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true, "requires": { - "assertion-error": "^1.0.1", - "check-error": "^1.0.1", - "deep-eql": "^3.0.0", - "get-func-name": "^2.0.0", - "pathval": "^1.0.0", - "type-detect": "^4.0.0" + "assertion-error": "1.1.0", + "check-error": "1.0.2", + "deep-eql": "3.0.1", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.8" } }, "chalk": { @@ -943,9 +987,9 @@ "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.4.0" } }, "check-error": { @@ -960,8 +1004,8 @@ "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "2.0.3", + "safe-buffer": "5.1.2" } }, "class-utils": { @@ -970,10 +1014,10 @@ "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" }, "dependencies": { "define-property": { @@ -982,7 +1026,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } } } @@ -994,8 +1038,8 @@ "dev": true, "optional": true, "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", + "center-align": "0.1.3", + "right-align": "0.1.3", "wordwrap": "0.0.2" }, "dependencies": { @@ -1032,9 +1076,9 @@ "integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==", "dev": true, "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" + "inherits": "2.0.3", + "process-nextick-args": "2.0.0", + "readable-stream": "2.3.6" } }, "collection-visit": { @@ -1043,8 +1087,8 @@ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true, "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" + "map-visit": "1.0.0", + "object-visit": "1.0.1" } }, "color-convert": { @@ -1053,7 +1097,7 @@ "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { - "color-name": "^1.1.1" + "color-name": "1.1.3" } }, "color-name": { @@ -1074,10 +1118,10 @@ "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", "dev": true, "requires": { - "convert-source-map": "~1.1.0", - "inline-source-map": "~0.6.0", - "lodash.memoize": "~3.0.3", - "source-map": "~0.5.3" + "convert-source-map": "1.1.3", + "inline-source-map": "0.6.2", + "lodash.memoize": "3.0.4", + "source-map": "0.5.7" }, "dependencies": { "convert-source-map": { @@ -1112,10 +1156,10 @@ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" + "buffer-from": "1.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "typedarray": "0.0.6" } }, "concat-with-sourcemaps": { @@ -1124,7 +1168,7 @@ "integrity": "sha512-5i4Spc9NNvVXzkR77x2kjcYCDZMNPLzP7ZBzJMNKZjXzk+E6tRVL/lPlYw60VM3hb7gf+iBQn2x1T8TpMN0SEw==", "dev": true, "requires": { - "source-map": "^0.6.1" + "source-map": "0.6.1" }, "dependencies": { "source-map": { @@ -1141,7 +1185,7 @@ "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "^0.1.4" + "date-now": "0.1.4" } }, "constants-browserify": { @@ -1174,8 +1218,8 @@ "integrity": "sha512-iZvCCg8XqHQZ1ioNBTzXS/cQSkqkqcPs8xSX4upNB+DAk9Ht3uzQf2J32uAHNCne8LDmKr29AgZrEs4oIrwLuQ==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" + "bn.js": "4.11.8", + "elliptic": "6.4.0" } }, "create-hash": { @@ -1184,11 +1228,11 @@ "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" + "cipher-base": "1.0.4", + "inherits": "2.0.3", + "md5.js": "1.3.4", + "ripemd160": "2.0.2", + "sha.js": "2.4.11" } }, "create-hmac": { @@ -1197,12 +1241,12 @@ "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "inherits": "2.0.3", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.2", + "sha.js": "2.4.11" } }, "crypto-browserify": { @@ -1211,17 +1255,17 @@ "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", "dev": true, "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" + "browserify-cipher": "1.0.1", + "browserify-sign": "4.0.4", + "create-ecdh": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "diffie-hellman": "5.0.3", + "inherits": "2.0.3", + "pbkdf2": "3.0.16", + "public-encrypt": "4.0.2", + "randombytes": "2.0.6", + "randomfill": "1.0.4" } }, "css": { @@ -1230,10 +1274,10 @@ "integrity": "sha1-c6TIHehdtmTU7mdPfUcIXjstVdw=", "dev": true, "requires": { - "inherits": "^2.0.1", - "source-map": "^0.1.38", - "source-map-resolve": "^0.3.0", - "urix": "^0.1.0" + "inherits": "2.0.3", + "source-map": "0.1.43", + "source-map-resolve": "0.3.1", + "urix": "0.1.0" }, "dependencies": { "atob": { @@ -1248,7 +1292,7 @@ "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", "dev": true, "requires": { - "amdefine": ">=0.0.4" + "amdefine": "1.0.1" } }, "source-map-resolve": { @@ -1257,10 +1301,10 @@ "integrity": "sha1-YQ9hIqRFuN1RU1oqcbeD38Ekh2E=", "dev": true, "requires": { - "atob": "~1.1.0", - "resolve-url": "~0.2.1", - "source-map-url": "~0.3.0", - "urix": "~0.1.0" + "atob": "1.1.3", + "resolve-url": "0.2.1", + "source-map-url": "0.3.0", + "urix": "0.1.0" } }, "source-map-url": { @@ -1277,7 +1321,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "^0.10.9" + "es5-ext": "0.10.42" } }, "date-now": { @@ -1307,9 +1351,9 @@ "integrity": "sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg==", "dev": true, "requires": { - "debug": "3.X", - "memoizee": "0.4.X", - "object-assign": "4.X" + "debug": "3.1.0", + "memoizee": "0.4.12", + "object-assign": "4.1.1" }, "dependencies": { "debug": { @@ -1342,7 +1386,7 @@ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "^4.0.0" + "type-detect": "4.0.8" } }, "deep-is": { @@ -1357,7 +1401,7 @@ "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "requires": { - "clone": "^1.0.2" + "clone": "1.0.4" } }, "define-properties": { @@ -1366,8 +1410,8 @@ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", "dev": true, "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" + "foreach": "2.0.5", + "object-keys": "1.0.11" } }, "define-property": { @@ -1376,8 +1420,8 @@ "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", "dev": true, "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" + "is-descriptor": "1.0.2", + "isobject": "3.0.1" }, "dependencies": { "is-accessor-descriptor": { @@ -1386,7 +1430,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-data-descriptor": { @@ -1395,7 +1439,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-descriptor": { @@ -1404,9 +1448,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" } } } @@ -1423,12 +1467,12 @@ "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", "dev": true, "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" + "globby": "6.1.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", + "p-map": "1.2.0", + "pify": "3.0.0", + "rimraf": "2.6.2" } }, "deprecated": { @@ -1443,10 +1487,10 @@ "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", "dev": true, "requires": { - "JSONStream": "^1.0.3", - "shasum": "^1.0.0", - "subarg": "^1.0.0", - "through2": "^2.0.0" + "JSONStream": "1.3.2", + "shasum": "1.0.2", + "subarg": "1.0.0", + "through2": "2.0.3" } }, "des.js": { @@ -1455,8 +1499,8 @@ "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "dev": true, "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" } }, "detect-file": { @@ -1477,9 +1521,9 @@ "integrity": "sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ==", "dev": true, "requires": { - "acorn-node": "^1.3.0", - "defined": "^1.0.0", - "minimist": "^1.1.1" + "acorn-node": "1.3.0", + "defined": "1.0.0", + "minimist": "1.2.0" } }, "diff": { @@ -1494,9 +1538,9 @@ "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" + "bn.js": "4.11.8", + "miller-rabin": "4.0.1", + "randombytes": "2.0.6" } }, "domain-browser": { @@ -1511,7 +1555,7 @@ "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", "dev": true, "requires": { - "readable-stream": "^2.0.2" + "readable-stream": "2.3.6" } }, "duplexify": { @@ -1520,10 +1564,10 @@ "integrity": "sha512-JzYSLYMhoVVBe8+mbHQ4KgpvHpm0DZpJuL8PY93Vyv1fW7jYJ90LoXa1di/CVbJM+TgMs91rbDapE/RNIfnJsA==", "dev": true, "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "stream-shift": "1.0.0" }, "dependencies": { "end-of-stream": { @@ -1532,7 +1576,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "^1.4.0" + "once": "1.4.0" } } } @@ -1543,13 +1587,13 @@ "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "dev": true, "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "bn.js": "4.11.8", + "brorand": "1.1.0", + "hash.js": "1.1.3", + "hmac-drbg": "1.0.1", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" } }, "end-of-stream": { @@ -1558,7 +1602,7 @@ "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", "dev": true, "requires": { - "once": "~1.3.0" + "once": "1.3.3" }, "dependencies": { "once": { @@ -1567,7 +1611,7 @@ "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } } } @@ -1578,9 +1622,9 @@ "integrity": "sha512-AJxO1rmPe1bDEfSR6TJ/FgMFYuTBhR5R57KW58iCkYACMyFbrkqVyzXSurYoScDGvgyMpk7uRF/lPUPPTmsRSA==", "dev": true, "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.1", - "next-tick": "1" + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1", + "next-tick": "1.0.0" } }, "es6-iterator": { @@ -1589,9 +1633,9 @@ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" + "d": "1.0.0", + "es5-ext": "0.10.42", + "es6-symbol": "3.1.1" } }, "es6-promise": { @@ -1600,14 +1644,31 @@ "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "4.2.4" + }, + "dependencies": { + "es6-promise": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", + "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", + "dev": true + } + } + }, "es6-symbol": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14" + "d": "1.0.0", + "es5-ext": "0.10.42" } }, "es6-weak-map": { @@ -1616,10 +1677,10 @@ "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.14", - "es6-iterator": "^2.0.1", - "es6-symbol": "^3.1.1" + "d": "1.0.0", + "es5-ext": "0.10.42", + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1" } }, "escape-string-regexp": { @@ -1634,11 +1695,11 @@ "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", "dev": true, "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" + "esprima": "2.7.3", + "estraverse": "1.9.3", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.2.0" }, "dependencies": { "source-map": { @@ -1648,7 +1709,7 @@ "dev": true, "optional": true, "requires": { - "amdefine": ">=0.0.4" + "amdefine": "1.0.1" } } } @@ -1677,8 +1738,8 @@ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "dev": true, "requires": { - "d": "1", - "es5-ext": "~0.10.14" + "d": "1.0.0", + "es5-ext": "0.10.42" } }, "events": { @@ -1693,8 +1754,8 @@ "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" + "md5.js": "1.3.4", + "safe-buffer": "5.1.2" } }, "expand-brackets": { @@ -1703,13 +1764,13 @@ "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", "dev": true, "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" }, "dependencies": { "define-property": { @@ -1718,7 +1779,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "extend-shallow": { @@ -1727,7 +1788,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } } } @@ -1738,7 +1799,7 @@ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "dev": true, "requires": { - "homedir-polyfill": "^1.0.1" + "homedir-polyfill": "1.0.1" } }, "extend": { @@ -1753,8 +1814,8 @@ "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" }, "dependencies": { "is-extendable": { @@ -1763,7 +1824,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "^2.0.4" + "is-plain-object": "2.0.4" } } } @@ -1774,14 +1835,14 @@ "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", "dev": true, "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" }, "dependencies": { "define-property": { @@ -1790,7 +1851,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "is-descriptor": "1.0.2" } }, "extend-shallow": { @@ -1799,7 +1860,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } }, "is-accessor-descriptor": { @@ -1808,7 +1869,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-data-descriptor": { @@ -1817,7 +1878,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-descriptor": { @@ -1826,9 +1887,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" } } } @@ -1839,9 +1900,9 @@ "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", "dev": true, "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "time-stamp": "^1.0.0" + "ansi-gray": "0.1.1", + "color-support": "1.1.3", + "time-stamp": "1.1.0" } }, "fast-levenshtein": { @@ -1856,8 +1917,8 @@ "integrity": "sha1-WKZBrR9XV0on/oekQO8xiDS1Vxk=", "dev": true, "requires": { - "minimatch": "^3.0.3", - "utilities": "^0.0.37" + "minimatch": "3.0.4", + "utilities": "0.0.37" }, "dependencies": { "utilities": { @@ -1874,10 +1935,10 @@ "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" }, "dependencies": { "extend-shallow": { @@ -1886,7 +1947,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } } } @@ -1903,10 +1964,10 @@ "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", "dev": true, "requires": { - "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" + "detect-file": "1.0.0", + "is-glob": "3.1.0", + "micromatch": "3.1.10", + "resolve-dir": "1.0.1" } }, "fined": { @@ -1915,11 +1976,11 @@ "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", "dev": true, "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", - "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" + "expand-tilde": "2.0.2", + "is-plain-object": "2.0.4", + "object.defaults": "1.1.0", + "object.pick": "1.3.0", + "parse-filepath": "1.0.2" } }, "first-chunk-stream": { @@ -1940,8 +2001,8 @@ "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", "dev": true, "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.4" + "inherits": "2.0.3", + "readable-stream": "2.3.6" } }, "for-in": { @@ -1956,7 +2017,7 @@ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", "dev": true, "requires": { - "for-in": "^1.0.1" + "for-in": "1.0.2" } }, "foreach": { @@ -1971,7 +2032,7 @@ "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true, "requires": { - "map-cache": "^0.2.2" + "map-cache": "0.2.2" } }, "fs-mkdirp-stream": { @@ -1980,8 +2041,8 @@ "integrity": "sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes=", "dev": true, "requires": { - "graceful-fs": "^4.1.11", - "through2": "^2.0.3" + "graceful-fs": "4.1.11", + "through2": "2.0.3" }, "dependencies": { "graceful-fs": { @@ -2010,7 +2071,7 @@ "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", "dev": true, "requires": { - "globule": "~0.1.0" + "globule": "0.1.0" } }, "get-func-name": { @@ -2031,12 +2092,12 @@ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "glob-parent": { @@ -2045,8 +2106,8 @@ "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", "dev": true, "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" + "is-glob": "3.1.0", + "path-dirname": "1.0.2" } }, "glob-stream": { @@ -2055,12 +2116,12 @@ "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", "dev": true, "requires": { - "glob": "^4.3.1", - "glob2base": "^0.0.12", - "minimatch": "^2.0.1", - "ordered-read-streams": "^0.1.0", - "through2": "^0.6.1", - "unique-stream": "^1.0.0" + "glob": "4.5.3", + "glob2base": "0.0.12", + "minimatch": "2.0.10", + "ordered-read-streams": "0.1.0", + "through2": "0.6.5", + "unique-stream": "1.0.0" }, "dependencies": { "glob": { @@ -2069,10 +2130,10 @@ "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^2.0.1", - "once": "^1.3.0" + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "2.0.10", + "once": "1.4.0" } }, "isarray": { @@ -2087,7 +2148,7 @@ "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", "dev": true, "requires": { - "brace-expansion": "^1.0.0" + "brace-expansion": "1.1.11" } }, "readable-stream": { @@ -2096,10 +2157,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -2114,8 +2175,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } } } @@ -2126,7 +2187,7 @@ "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", "dev": true, "requires": { - "gaze": "^0.5.1" + "gaze": "0.5.2" } }, "glob2base": { @@ -2135,7 +2196,7 @@ "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", "dev": true, "requires": { - "find-index": "^0.1.1" + "find-index": "0.1.1" } }, "global-modules": { @@ -2144,9 +2205,9 @@ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" + "global-prefix": "1.0.2", + "is-windows": "1.0.2", + "resolve-dir": "1.0.1" } }, "global-prefix": { @@ -2155,11 +2216,11 @@ "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", "dev": true, "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" + "expand-tilde": "2.0.2", + "homedir-polyfill": "1.0.1", + "ini": "1.3.5", + "is-windows": "1.0.2", + "which": "1.3.0" } }, "globby": { @@ -2168,11 +2229,11 @@ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "array-union": "1.0.2", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" }, "dependencies": { "pify": { @@ -2189,9 +2250,9 @@ "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", "dev": true, "requires": { - "glob": "~3.1.21", - "lodash": "~1.0.1", - "minimatch": "~0.2.11" + "glob": "3.1.21", + "lodash": "1.0.2", + "minimatch": "0.2.14" }, "dependencies": { "glob": { @@ -2200,9 +2261,9 @@ "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", "dev": true, "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" + "graceful-fs": "1.2.3", + "inherits": "1.0.2", + "minimatch": "0.2.14" } }, "graceful-fs": { @@ -2223,8 +2284,8 @@ "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", "dev": true, "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "lru-cache": "2.7.3", + "sigmund": "1.0.1" } } } @@ -2235,7 +2296,7 @@ "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", "dev": true, "requires": { - "sparkles": "^1.0.0" + "sparkles": "1.0.0" } }, "graceful-fs": { @@ -2244,7 +2305,7 @@ "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", "dev": true, "requires": { - "natives": "^1.1.0" + "natives": "1.1.3" } }, "growl": { @@ -2259,19 +2320,19 @@ "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", "dev": true, "requires": { - "archy": "^1.0.0", - "chalk": "^1.0.0", - "deprecated": "^0.0.1", - "gulp-util": "^3.0.0", - "interpret": "^1.0.0", - "liftoff": "^2.1.0", - "minimist": "^1.1.0", - "orchestrator": "^0.3.0", - "pretty-hrtime": "^1.0.0", - "semver": "^4.1.0", - "tildify": "^1.0.0", - "v8flags": "^2.0.2", - "vinyl-fs": "^0.3.0" + "archy": "1.0.0", + "chalk": "1.1.3", + "deprecated": "0.0.1", + "gulp-util": "3.0.8", + "interpret": "1.1.0", + "liftoff": "2.5.0", + "minimist": "1.2.0", + "orchestrator": "0.3.8", + "pretty-hrtime": "1.0.3", + "semver": "4.3.6", + "tildify": "1.2.0", + "v8flags": "2.1.1", + "vinyl-fs": "0.3.14" }, "dependencies": { "ansi-styles": { @@ -2286,11 +2347,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -2307,8 +2368,8 @@ "integrity": "sha512-SLg/KsHBbinR/pCX3PF5l1YlR28hLp0X+bcpf77PtMJ6zvAQ5kRjtCPV5Wt1wHXsXWZN0eTUZ15R8ZYpi/CdCA==", "dev": true, "requires": { - "plugin-error": "^0.1.2", - "through2": "^2.0.3" + "plugin-error": "0.1.2", + "through2": "2.0.3" } }, "gulp-concat": { @@ -2317,9 +2378,9 @@ "integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=", "dev": true, "requires": { - "concat-with-sourcemaps": "^1.0.0", - "through2": "^2.0.0", - "vinyl": "^2.0.0" + "concat-with-sourcemaps": "1.0.7", + "through2": "2.0.3", + "vinyl": "2.1.0" } }, "gulp-help": { @@ -2328,8 +2389,8 @@ "integrity": "sha1-Jh2xhuGDl/7z9qLCLpwxW/qIrgw=", "dev": true, "requires": { - "chalk": "^1.0.0", - "object-assign": "^3.0.0" + "chalk": "1.1.3", + "object-assign": "3.0.0" }, "dependencies": { "ansi-styles": { @@ -2344,11 +2405,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "object-assign": { @@ -2371,7 +2432,7 @@ "integrity": "sha1-MjE/E+SiPPWsylzl8MCAkjx3hgI=", "dev": true, "requires": { - "readable-stream": "^1.0.26-4", + "readable-stream": "1.1.14", "streamqueue": "0.0.6" }, "dependencies": { @@ -2387,10 +2448,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -2407,9 +2468,9 @@ "integrity": "sha512-h79fGO55S/P9eAADbLAP9aTtVYpLSR1ONj08VPaSdVVNVYhTS8p1CO1TW7kEMu+hC+sytmCqcUr5LesvZEtDoQ==", "dev": true, "requires": { - "glob": "^7.0.3", - "kew": "^0.7.0", - "plugin-error": "^0.1.2" + "glob": "7.1.2", + "kew": "0.7.0", + "plugin-error": "0.1.2" } }, "gulp-sourcemaps": { @@ -2418,17 +2479,17 @@ "integrity": "sha1-y7IAhFCxvM5s0jv5gze+dRv24wo=", "dev": true, "requires": { - "@gulp-sourcemaps/identity-map": "1.X", - "@gulp-sourcemaps/map-sources": "1.X", - "acorn": "5.X", - "convert-source-map": "1.X", - "css": "2.X", - "debug-fabulous": "1.X", - "detect-newline": "2.X", - "graceful-fs": "4.X", - "source-map": "~0.6.0", - "strip-bom-string": "1.X", - "through2": "2.X" + "@gulp-sourcemaps/identity-map": "1.0.1", + "@gulp-sourcemaps/map-sources": "1.0.0", + "acorn": "5.5.3", + "convert-source-map": "1.5.1", + "css": "2.2.1", + "debug-fabulous": "1.1.0", + "detect-newline": "2.1.0", + "graceful-fs": "4.1.11", + "source-map": "0.6.1", + "strip-bom-string": "1.0.0", + "through2": "2.0.3" }, "dependencies": { "acorn": { @@ -2457,12 +2518,12 @@ "integrity": "sha512-Hhbn5Aa2l3T+tnn0KqsG6RRJmcYEsr3byTL2nBpNBeAK8pqug9Od4AwddU4JEI+hRw7mzZyjRbB8DDWR6paGVA==", "dev": true, "requires": { - "ansi-colors": "^1.0.1", - "plugin-error": "^0.1.2", - "source-map": "^0.6.1", - "through2": "^2.0.3", - "vinyl": "^2.1.0", - "vinyl-fs": "^3.0.0" + "ansi-colors": "1.1.0", + "plugin-error": "0.1.2", + "source-map": "0.6.1", + "through2": "2.0.3", + "vinyl": "2.1.0", + "vinyl-fs": "3.0.2" }, "dependencies": { "glob-stream": { @@ -2471,16 +2532,16 @@ "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", "dev": true, "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" + "extend": "3.0.1", + "glob": "7.1.2", + "glob-parent": "3.1.0", + "is-negated-glob": "1.0.0", + "ordered-read-streams": "1.0.1", + "pumpify": "1.4.0", + "readable-stream": "2.3.6", + "remove-trailing-separator": "1.1.0", + "to-absolute-glob": "2.0.2", + "unique-stream": "2.2.1" } }, "graceful-fs": { @@ -2495,7 +2556,7 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { - "jsonify": "~0.0.0" + "jsonify": "0.0.0" } }, "ordered-read-streams": { @@ -2504,7 +2565,7 @@ "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", "dev": true, "requires": { - "readable-stream": "^2.0.1" + "readable-stream": "2.3.6" } }, "source-map": { @@ -2519,8 +2580,8 @@ "integrity": "sha1-WqADz76Uxf+GbE59ZouxxNuts2k=", "dev": true, "requires": { - "json-stable-stringify": "^1.0.0", - "through2-filter": "^2.0.0" + "json-stable-stringify": "1.0.1", + "through2-filter": "2.0.0" } }, "vinyl-fs": { @@ -2529,23 +2590,23 @@ "integrity": "sha512-AUSFda1OukBwuLPBTbyuO4IRWgfXmqC4UTW0f8xrCa8Hkv9oyIU+NSqBlgfOLZRoUt7cHdo75hKQghCywpIyIw==", "dev": true, "requires": { - "fs-mkdirp-stream": "^1.0.0", - "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", - "is-valid-glob": "^1.0.0", - "lazystream": "^1.0.0", - "lead": "^1.0.0", - "object.assign": "^4.0.4", - "pumpify": "^1.3.5", - "readable-stream": "^2.3.3", - "remove-bom-buffer": "^3.0.0", - "remove-bom-stream": "^1.2.0", - "resolve-options": "^1.1.0", - "through2": "^2.0.0", - "to-through": "^2.0.0", - "value-or-function": "^3.0.0", - "vinyl": "^2.0.0", - "vinyl-sourcemap": "^1.1.0" + "fs-mkdirp-stream": "1.0.0", + "glob-stream": "6.1.0", + "graceful-fs": "4.1.11", + "is-valid-glob": "1.0.0", + "lazystream": "1.0.0", + "lead": "1.0.0", + "object.assign": "4.1.0", + "pumpify": "1.4.0", + "readable-stream": "2.3.6", + "remove-bom-buffer": "3.0.0", + "remove-bom-stream": "1.2.0", + "resolve-options": "1.1.0", + "through2": "2.0.3", + "to-through": "2.0.0", + "value-or-function": "3.0.0", + "vinyl": "2.1.0", + "vinyl-sourcemap": "1.1.0" } } } @@ -2556,24 +2617,24 @@ "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", "dev": true, "requires": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.0", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "lodash._reescape": "^3.0.0", - "lodash._reevaluate": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.template": "^3.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", + "array-differ": "1.0.0", + "array-uniq": "1.0.3", + "beeper": "1.1.1", + "chalk": "1.1.3", + "dateformat": "2.2.0", + "fancy-log": "1.3.2", + "gulplog": "1.0.0", + "has-gulplog": "0.1.0", + "lodash._reescape": "3.0.0", + "lodash._reevaluate": "3.0.0", + "lodash._reinterpolate": "3.0.0", + "lodash.template": "3.6.2", + "minimist": "1.2.0", + "multipipe": "0.1.2", + "object-assign": "3.0.0", "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" + "through2": "2.0.3", + "vinyl": "0.5.3" }, "dependencies": { "ansi-styles": { @@ -2588,11 +2649,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "object-assign": { @@ -2613,8 +2674,8 @@ "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", "dev": true, "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", + "clone": "1.0.4", + "clone-stats": "0.0.1", "replace-ext": "0.0.1" } } @@ -2626,7 +2687,7 @@ "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", "dev": true, "requires": { - "glogg": "^1.0.0" + "glogg": "1.0.1" } }, "handlebars": { @@ -2635,10 +2696,10 @@ "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", "dev": true, "requires": { - "async": "^1.4.0", - "optimist": "^0.6.1", - "source-map": "^0.4.4", - "uglify-js": "^2.6" + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" }, "dependencies": { "source-map": { @@ -2647,7 +2708,7 @@ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { - "amdefine": ">=0.0.4" + "amdefine": "1.0.1" } } } @@ -2658,7 +2719,7 @@ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", "dev": true, "requires": { - "function-bind": "^1.0.2" + "function-bind": "1.1.1" } }, "has-ansi": { @@ -2667,7 +2728,7 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "has-color": { @@ -2688,7 +2749,7 @@ "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", "dev": true, "requires": { - "sparkles": "^1.0.0" + "sparkles": "1.0.0" } }, "has-symbols": { @@ -2703,9 +2764,9 @@ "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" } }, "has-values": { @@ -2714,8 +2775,8 @@ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "3.0.0", + "kind-of": "4.0.0" }, "dependencies": { "kind-of": { @@ -2724,7 +2785,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2735,8 +2796,8 @@ "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "2.0.3", + "safe-buffer": "5.1.2" } }, "hash.js": { @@ -2745,8 +2806,8 @@ "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", "dev": true, "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" } }, "he": { @@ -2761,9 +2822,9 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" + "hash.js": "1.1.3", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" } }, "homedir-polyfill": { @@ -2772,7 +2833,7 @@ "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", "dev": true, "requires": { - "parse-passwd": "^1.0.0" + "parse-passwd": "1.0.0" } }, "htmlescape": { @@ -2781,12 +2842,54 @@ "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", "dev": true }, + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "dev": true, + "requires": { + "agent-base": "4.2.0", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, "https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "4.2.0", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, "ieee754": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz", @@ -2799,8 +2902,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -2821,7 +2924,7 @@ "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", "dev": true, "requires": { - "source-map": "~0.5.3" + "source-map": "0.5.7" } }, "insert-module-globals": { @@ -2830,15 +2933,15 @@ "integrity": "sha512-R3sidKJr3SsggqQQ5cEwQb3pWG8RNx0UnpyeiOSR6jorRIeAOzH2gkTWnNdMnyRiVbjrG047K7UCtlMkQ1Mo9w==", "dev": true, "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "^0.8.0", - "concat-stream": "^1.6.1", - "is-buffer": "^1.1.0", - "lexical-scope": "^1.2.0", - "path-is-absolute": "^1.0.1", - "process": "~0.11.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" + "combine-source-map": "0.8.0", + "concat-stream": "1.6.2", + "is-buffer": "1.1.6", + "JSONStream": "1.3.2", + "lexical-scope": "1.2.0", + "path-is-absolute": "1.0.1", + "process": "0.11.10", + "through2": "2.0.3", + "xtend": "4.0.1" } }, "interpret": { @@ -2853,8 +2956,8 @@ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" + "is-relative": "1.0.0", + "is-windows": "1.0.2" } }, "is-accessor-descriptor": { @@ -2863,7 +2966,7 @@ "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -2872,7 +2975,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2889,7 +2992,7 @@ "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -2898,7 +3001,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2909,9 +3012,9 @@ "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" }, "dependencies": { "kind-of": { @@ -2940,7 +3043,7 @@ "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { - "is-extglob": "^2.1.0" + "is-extglob": "2.1.1" } }, "is-negated-glob": { @@ -2955,7 +3058,7 @@ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -2964,7 +3067,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -2975,7 +3078,7 @@ "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", "dev": true, "requires": { - "is-number": "^4.0.0" + "is-number": "4.0.0" }, "dependencies": { "is-number": { @@ -2998,7 +3101,7 @@ "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { - "is-path-inside": "^1.0.0" + "is-path-inside": "1.0.1" } }, "is-path-inside": { @@ -3007,7 +3110,7 @@ "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { - "path-is-inside": "^1.0.1" + "path-is-inside": "1.0.2" } }, "is-plain-object": { @@ -3016,7 +3119,7 @@ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { - "isobject": "^3.0.1" + "isobject": "3.0.1" } }, "is-promise": { @@ -3031,7 +3134,7 @@ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { - "is-unc-path": "^1.0.0" + "is-unc-path": "1.0.0" } }, "is-unc-path": { @@ -3040,7 +3143,7 @@ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { - "unc-path-regex": "^0.1.2" + "unc-path-regex": "0.1.2" } }, "is-utf8": { @@ -3085,20 +3188,20 @@ "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", "dev": true, "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" + "abbrev": "1.0.9", + "async": "1.5.2", + "escodegen": "1.8.1", + "esprima": "2.7.3", + "glob": "5.0.15", + "handlebars": "4.0.11", + "js-yaml": "3.11.0", + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "once": "1.4.0", + "resolve": "1.1.7", + "supports-color": "3.2.3", + "which": "1.3.0", + "wordwrap": "1.0.0" }, "dependencies": { "glob": { @@ -3107,11 +3210,11 @@ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "has-flag": { @@ -3126,7 +3229,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "^1.0.0" + "has-flag": "1.0.0" } } } @@ -3137,11 +3240,11 @@ "integrity": "sha512-qUTOVCKFkiz3tHgV1WMy7HTxDZgo+sO4X9GxFLAU+Mks4WsDGe9+ONHK6tPsSp8I3x6sPl0TwGbXHwTOhTyzog==", "dev": true, "requires": { - "async": "0.9.x", - "chalk": "0.4.x", - "filelist": "0.0.x", - "minimatch": "3.x", - "utilities": "1.0.x" + "async": "0.9.2", + "chalk": "0.4.0", + "filelist": "0.0.6", + "minimatch": "3.0.4", + "utilities": "1.0.5" }, "dependencies": { "ansi-styles": { @@ -3162,9 +3265,9 @@ "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", "dev": true, "requires": { - "ansi-styles": "~1.0.0", - "has-color": "~0.1.0", - "strip-ansi": "~0.1.0" + "ansi-styles": "1.0.0", + "has-color": "0.1.7", + "strip-ansi": "0.1.1" } }, "strip-ansi": { @@ -3187,8 +3290,8 @@ "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "1.0.10", + "esprima": "4.0.0" }, "dependencies": { "esprima": { @@ -3205,7 +3308,7 @@ "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", "dev": true, "requires": { - "jsonify": "~0.0.0" + "jsonify": "0.0.0" } }, "jsonify": { @@ -3220,6 +3323,16 @@ "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "dev": true }, + "JSONStream": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", + "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo=", + "dev": true, + "requires": { + "jsonparse": "1.3.1", + "through": "2.3.8" + } + }, "kew": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", @@ -3238,9 +3351,9 @@ "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==", "dev": true, "requires": { - "inherits": "^2.0.1", - "isarray": "^2.0.4", - "stream-splicer": "^2.0.0" + "inherits": "2.0.3", + "isarray": "2.0.4", + "stream-splicer": "2.0.0" }, "dependencies": { "isarray": { @@ -3264,7 +3377,7 @@ "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", "dev": true, "requires": { - "readable-stream": "^2.0.5" + "readable-stream": "2.3.6" } }, "lead": { @@ -3273,7 +3386,7 @@ "integrity": "sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI=", "dev": true, "requires": { - "flush-write-stream": "^1.0.2" + "flush-write-stream": "1.0.3" } }, "levn": { @@ -3282,8 +3395,8 @@ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", "dev": true, "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" + "prelude-ls": "1.1.2", + "type-check": "0.3.2" } }, "lexical-scope": { @@ -3292,7 +3405,7 @@ "integrity": "sha1-/Ope3HBKSzqHls3KQZw6CvryLfQ=", "dev": true, "requires": { - "astw": "^2.0.0" + "astw": "2.2.0" } }, "liftoff": { @@ -3301,14 +3414,14 @@ "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", "dev": true, "requires": { - "extend": "^3.0.0", - "findup-sync": "^2.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", - "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" + "extend": "3.0.1", + "findup-sync": "2.0.0", + "fined": "1.1.0", + "flagged-respawn": "1.0.0", + "is-plain-object": "2.0.4", + "object.map": "1.0.1", + "rechoir": "0.6.2", + "resolve": "1.1.7" } }, "lodash": { @@ -3377,7 +3490,7 @@ "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", "dev": true, "requires": { - "lodash._root": "^3.0.0" + "lodash._root": "3.0.1" } }, "lodash.isarguments": { @@ -3398,9 +3511,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" } }, "lodash.memoize": { @@ -3421,15 +3534,15 @@ "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", "dev": true, "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" + "lodash._basecopy": "3.0.1", + "lodash._basetostring": "3.0.1", + "lodash._basevalues": "3.0.0", + "lodash._isiterateecall": "3.0.9", + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0", + "lodash.keys": "3.1.2", + "lodash.restparam": "3.6.1", + "lodash.templatesettings": "3.1.1" } }, "lodash.templatesettings": { @@ -3438,8 +3551,8 @@ "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", "dev": true, "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0" } }, "longest": { @@ -3460,7 +3573,7 @@ "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", "dev": true, "requires": { - "es5-ext": "~0.10.2" + "es5-ext": "0.10.42" } }, "make-iterator": { @@ -3469,7 +3582,7 @@ "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "dev": true, "requires": { - "kind-of": "^6.0.2" + "kind-of": "6.0.2" } }, "map-cache": { @@ -3484,7 +3597,7 @@ "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { - "object-visit": "^1.0.0" + "object-visit": "1.0.1" } }, "md5.js": { @@ -3493,8 +3606,8 @@ "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "dev": true, "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "hash-base": "3.0.4", + "inherits": "2.0.3" } }, "memoizee": { @@ -3503,14 +3616,14 @@ "integrity": "sha512-sprBu6nwxBWBvBOh5v2jcsGqiGLlL2xr2dLub3vR8dnE8YB17omwtm/0NSHl8jjNbcsJd5GMWJAnTSVe/O0Wfg==", "dev": true, "requires": { - "d": "1", - "es5-ext": "^0.10.30", - "es6-weak-map": "^2.0.2", - "event-emitter": "^0.3.5", - "is-promise": "^2.1", - "lru-queue": "0.1", - "next-tick": "1", - "timers-ext": "^0.1.2" + "d": "1.0.0", + "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.5" } }, "merge2": { @@ -3525,19 +3638,19 @@ "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "dev": true, "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.9", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" } }, "miller-rabin": { @@ -3546,8 +3659,8 @@ "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "dev": true, "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" + "bn.js": "4.11.8", + "brorand": "1.1.0" } }, "minimalistic-assert": { @@ -3568,7 +3681,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -3583,8 +3696,8 @@ "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "dev": true, "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" + "for-in": "1.0.2", + "is-extendable": "1.0.1" }, "dependencies": { "is-extendable": { @@ -3593,7 +3706,7 @@ "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, "requires": { - "is-plain-object": "^2.0.4" + "is-plain-object": "2.0.4" } } } @@ -3655,7 +3768,7 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true, "requires": { - "has-flag": "^2.0.0" + "has-flag": "2.0.0" } } } @@ -3672,21 +3785,21 @@ "integrity": "sha512-KWBI3009iRnHjRlxRhe8nJ6kdeBTg4sMi5N6AZgg5f1/v5S7EBCRBOY854I4P5Anl4kx6AJH+4bBBC2Gi3nkvg==", "dev": true, "requires": { - "JSONStream": "^1.0.3", - "browser-resolve": "^1.7.0", - "cached-path-relative": "^1.0.0", - "concat-stream": "~1.6.0", - "defined": "^1.0.0", - "detective": "^5.0.2", - "duplexer2": "^0.1.2", - "inherits": "^2.0.1", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.4.0", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" + "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", + "JSONStream": "1.3.2", + "parents": "1.0.1", + "readable-stream": "2.3.6", + "resolve": "1.7.1", + "stream-combiner2": "1.1.1", + "subarg": "1.0.0", + "through2": "2.0.3", + "xtend": "4.0.1" }, "dependencies": { "resolve": { @@ -3695,7 +3808,7 @@ "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", "dev": true, "requires": { - "path-parse": "^1.0.5" + "path-parse": "1.0.5" } } } @@ -3721,7 +3834,7 @@ "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", "dev": true, "requires": { - "readable-stream": "~1.1.9" + "readable-stream": "1.1.14" } }, "isarray": { @@ -3736,10 +3849,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -3756,18 +3869,18 @@ "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", "dev": true, "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-odd": "^2.0.0", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-odd": "2.0.0", + "is-windows": "1.0.2", + "kind-of": "6.0.2", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" } }, "natives": { @@ -3782,13 +3895,19 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "node-fetch": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.1.2.tgz", + "integrity": "sha1-q4hOjn5X44qUR1POxwb3iNF2i7U=", + "dev": true + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "dev": true, "requires": { - "abbrev": "1" + "abbrev": "1.0.9" } }, "normalize-path": { @@ -3797,7 +3916,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "^1.0.1" + "remove-trailing-separator": "1.1.0" } }, "now-and-later": { @@ -3806,7 +3925,7 @@ "integrity": "sha1-vGHLtFbXnLMiB85HygUTb/Ln1u4=", "dev": true, "requires": { - "once": "^1.3.2" + "once": "1.4.0" } }, "object-assign": { @@ -3821,9 +3940,9 @@ "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" }, "dependencies": { "define-property": { @@ -3832,7 +3951,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "kind-of": { @@ -3841,7 +3960,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -3858,7 +3977,7 @@ "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "dev": true, "requires": { - "isobject": "^3.0.0" + "isobject": "3.0.1" } }, "object.assign": { @@ -3867,10 +3986,10 @@ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" + "define-properties": "1.1.2", + "function-bind": "1.1.1", + "has-symbols": "1.0.0", + "object-keys": "1.0.11" } }, "object.defaults": { @@ -3879,10 +3998,10 @@ "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", "dev": true, "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" + "array-each": "1.0.1", + "array-slice": "1.1.0", + "for-own": "1.0.0", + "isobject": "3.0.1" } }, "object.map": { @@ -3891,8 +4010,8 @@ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", "dev": true, "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" + "for-own": "1.0.0", + "make-iterator": "1.0.1" } }, "object.pick": { @@ -3901,7 +4020,7 @@ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, "requires": { - "isobject": "^3.0.1" + "isobject": "3.0.1" } }, "once": { @@ -3910,7 +4029,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "optimist": { @@ -3919,8 +4038,8 @@ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" + "minimist": "0.0.10", + "wordwrap": "0.0.3" }, "dependencies": { "minimist": { @@ -3943,12 +4062,12 @@ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", "dev": true, "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" } }, "orchestrator": { @@ -3957,9 +4076,9 @@ "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", "dev": true, "requires": { - "end-of-stream": "~0.1.5", - "sequencify": "~0.0.7", - "stream-consume": "~0.1.0" + "end-of-stream": "0.1.5", + "sequencify": "0.0.7", + "stream-consume": "0.1.1" } }, "ordered-read-streams": { @@ -3998,7 +4117,7 @@ "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", "dev": true, "requires": { - "path-platform": "~0.11.15" + "path-platform": "0.11.15" } }, "parse-asn1": { @@ -4007,11 +4126,11 @@ "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "dev": true, "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3" + "asn1.js": "4.10.1", + "browserify-aes": "1.2.0", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "pbkdf2": "3.0.16" } }, "parse-filepath": { @@ -4020,9 +4139,9 @@ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", "dev": true, "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" + "is-absolute": "1.0.0", + "map-cache": "0.2.2", + "path-root": "0.1.1" } }, "parse-passwd": { @@ -4079,7 +4198,7 @@ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", "dev": true, "requires": { - "path-root-regex": "^0.1.0" + "path-root-regex": "0.1.2" } }, "path-root-regex": { @@ -4100,11 +4219,11 @@ "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", "dev": true, "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.2", + "sha.js": "2.4.11" } }, "pify": { @@ -4125,7 +4244,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "^2.0.0" + "pinkie": "2.0.4" } }, "plugin-error": { @@ -4134,11 +4253,11 @@ "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", "dev": true, "requires": { - "ansi-cyan": "^0.1.1", - "ansi-red": "^0.1.1", - "arr-diff": "^1.0.1", - "arr-union": "^2.0.1", - "extend-shallow": "^1.1.2" + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" }, "dependencies": { "arr-diff": { @@ -4147,8 +4266,8 @@ "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", "dev": true, "requires": { - "arr-flatten": "^1.0.1", - "array-slice": "^0.2.3" + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" } }, "arr-union": { @@ -4169,7 +4288,7 @@ "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", "dev": true, "requires": { - "kind-of": "^1.1.0" + "kind-of": "1.1.0" } }, "kind-of": { @@ -4216,11 +4335,11 @@ "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1" + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "parse-asn1": "5.1.1", + "randombytes": "2.0.6" } }, "pump": { @@ -4229,8 +4348,8 @@ "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", "dev": true, "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "end-of-stream": "1.4.1", + "once": "1.4.0" }, "dependencies": { "end-of-stream": { @@ -4239,7 +4358,7 @@ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { - "once": "^1.4.0" + "once": "1.4.0" } } } @@ -4250,9 +4369,9 @@ "integrity": "sha512-2kmNR9ry+Pf45opRVirpNuIFotsxUGLaYqxIwuR77AYrYRMuFCz9eryHBS52L360O+NcR383CL4QYlMKPq4zYA==", "dev": true, "requires": { - "duplexify": "^3.5.3", - "inherits": "^2.0.3", - "pump": "^2.0.0" + "duplexify": "3.5.4", + "inherits": "2.0.3", + "pump": "2.0.1" } }, "punycode": { @@ -4285,7 +4404,7 @@ "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", "dev": true, "requires": { - "safe-buffer": "^5.1.0" + "safe-buffer": "5.1.2" } }, "randomfill": { @@ -4294,8 +4413,8 @@ "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", "dev": true, "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" + "randombytes": "2.0.6", + "safe-buffer": "5.1.2" } }, "read-only-stream": { @@ -4304,7 +4423,7 @@ "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", "dev": true, "requires": { - "readable-stream": "^2.0.2" + "readable-stream": "2.3.6" } }, "readable-stream": { @@ -4313,13 +4432,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" } }, "rechoir": { @@ -4328,7 +4447,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "^1.1.6" + "resolve": "1.1.7" } }, "regex-not": { @@ -4337,8 +4456,8 @@ "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", "dev": true, "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" + "extend-shallow": "3.0.2", + "safe-regex": "1.1.0" } }, "remove-bom-buffer": { @@ -4347,8 +4466,8 @@ "integrity": "sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==", "dev": true, "requires": { - "is-buffer": "^1.1.5", - "is-utf8": "^0.2.1" + "is-buffer": "1.1.6", + "is-utf8": "0.2.1" } }, "remove-bom-stream": { @@ -4357,9 +4476,9 @@ "integrity": "sha1-BfGlk/FuQuH7kOv1nejlaVJflSM=", "dev": true, "requires": { - "remove-bom-buffer": "^3.0.0", - "safe-buffer": "^5.1.0", - "through2": "^2.0.3" + "remove-bom-buffer": "3.0.0", + "safe-buffer": "5.1.2", + "through2": "2.0.3" } }, "remove-trailing-separator": { @@ -4398,8 +4517,8 @@ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", "dev": true, "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" + "expand-tilde": "2.0.2", + "global-modules": "1.0.0" } }, "resolve-options": { @@ -4408,7 +4527,7 @@ "integrity": "sha1-MrueOcBtZzONyTeMDW1gdFZq0TE=", "dev": true, "requires": { - "value-or-function": "^3.0.0" + "value-or-function": "3.0.0" } }, "resolve-url": { @@ -4430,7 +4549,7 @@ "dev": true, "optional": true, "requires": { - "align-text": "^0.1.1" + "align-text": "0.1.4" } }, "rimraf": { @@ -4439,7 +4558,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "7.1.2" } }, "ripemd160": { @@ -4448,8 +4567,8 @@ "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "hash-base": "3.0.4", + "inherits": "2.0.3" } }, "run-sequence": { @@ -4458,9 +4577,9 @@ "integrity": "sha512-qkzZnQWMZjcKbh3CNly2srtrkaO/2H/SI5f2eliMCapdRD3UhMrwjfOAZJAnZ2H8Ju4aBzFZkBGXUqFs9V0yxw==", "dev": true, "requires": { - "chalk": "^1.1.3", - "fancy-log": "^1.3.2", - "plugin-error": "^0.1.2" + "chalk": "1.1.3", + "fancy-log": "1.3.2", + "plugin-error": "0.1.2" }, "dependencies": { "ansi-styles": { @@ -4475,11 +4594,11 @@ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" } }, "supports-color": { @@ -4502,7 +4621,7 @@ "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { - "ret": "~0.1.10" + "ret": "0.1.15" } }, "sander": { @@ -4511,10 +4630,10 @@ "integrity": "sha1-dB4kXiMfB8r7b98PEzrfohalAq0=", "dev": true, "requires": { - "es6-promise": "^3.1.2", - "graceful-fs": "^4.1.3", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.2" + "es6-promise": "3.3.1", + "graceful-fs": "4.1.11", + "mkdirp": "0.5.1", + "rimraf": "2.6.2" }, "dependencies": { "graceful-fs": { @@ -4549,10 +4668,10 @@ "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" }, "dependencies": { "extend-shallow": { @@ -4561,7 +4680,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } } } @@ -4572,8 +4691,8 @@ "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "2.0.3", + "safe-buffer": "5.1.2" } }, "shasum": { @@ -4582,8 +4701,8 @@ "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", "dev": true, "requires": { - "json-stable-stringify": "~0.0.0", - "sha.js": "~2.4.4" + "json-stable-stringify": "0.0.1", + "sha.js": "2.4.11" } }, "shell-quote": { @@ -4592,10 +4711,10 @@ "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", "dev": true, "requires": { - "array-filter": "~0.0.0", - "array-map": "~0.0.0", - "array-reduce": "~0.0.0", - "jsonify": "~0.0.0" + "array-filter": "0.0.1", + "array-map": "0.0.0", + "array-reduce": "0.0.0", + "jsonify": "0.0.0" } }, "sigmund": { @@ -4610,14 +4729,14 @@ "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "dev": true, "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.1", + "use": "3.1.0" }, "dependencies": { "define-property": { @@ -4626,7 +4745,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } }, "extend-shallow": { @@ -4635,7 +4754,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } } } @@ -4646,9 +4765,9 @@ "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" }, "dependencies": { "define-property": { @@ -4657,7 +4776,7 @@ "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, "requires": { - "is-descriptor": "^1.0.0" + "is-descriptor": "1.0.2" } }, "is-accessor-descriptor": { @@ -4666,7 +4785,7 @@ "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-data-descriptor": { @@ -4675,7 +4794,7 @@ "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, "requires": { - "kind-of": "^6.0.0" + "kind-of": "6.0.2" } }, "is-descriptor": { @@ -4684,9 +4803,9 @@ "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" } } } @@ -4697,7 +4816,7 @@ "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { - "kind-of": "^3.2.0" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -4706,7 +4825,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -4717,10 +4836,10 @@ "integrity": "sha1-iukK19fLBfxZ8asMY3hF1cFaUrc=", "dev": true, "requires": { - "buffer-crc32": "^0.2.5", - "minimist": "^1.2.0", - "sander": "^0.5.0", - "sourcemap-codec": "^1.3.0" + "buffer-crc32": "0.2.13", + "minimist": "1.2.0", + "sander": "0.5.1", + "sourcemap-codec": "1.4.1" } }, "source-map": { @@ -4735,11 +4854,11 @@ "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", "dev": true, "requires": { - "atob": "^2.0.0", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" + "atob": "2.1.0", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" } }, "source-map-support": { @@ -4748,8 +4867,8 @@ "integrity": "sha512-mR7/Nd5l1z6g99010shcXJiNEaf3fEtmLhRB/sBcQVJGodcHCULPp2y4Sfa43Kv2zq7T+Izmfp/WHCR6dYkQCA==", "dev": true, "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "buffer-from": "1.0.0", + "source-map": "0.6.1" }, "dependencies": { "source-map": { @@ -4784,7 +4903,7 @@ "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { - "extend-shallow": "^3.0.0" + "extend-shallow": "3.0.2" } }, "sprintf-js": { @@ -4799,8 +4918,8 @@ "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "dev": true, "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" + "define-property": "0.2.5", + "object-copy": "0.1.0" }, "dependencies": { "define-property": { @@ -4809,7 +4928,7 @@ "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "is-descriptor": "0.1.6" } } } @@ -4820,8 +4939,8 @@ "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" + "inherits": "2.0.3", + "readable-stream": "2.3.6" } }, "stream-combiner2": { @@ -4830,8 +4949,8 @@ "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", "dev": true, "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" + "duplexer2": "0.1.4", + "readable-stream": "2.3.6" } }, "stream-consume": { @@ -4846,11 +4965,11 @@ "integrity": "sha512-cQ0jo17BLca2r0GfRdZKYAGLU6JRoIWxqSOakUMuKOT6MOK7AAlE856L33QuDmAy/eeOrhLee3dZKX0Uadu93A==", "dev": true, "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.3", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" } }, "stream-shift": { @@ -4865,8 +4984,8 @@ "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", "dev": true, "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" + "inherits": "2.0.3", + "readable-stream": "2.3.6" } }, "streamqueue": { @@ -4875,7 +4994,7 @@ "integrity": "sha1-ZvX17JTpuK8knkrsLdH3Qb/pTeM=", "dev": true, "requires": { - "readable-stream": "^1.0.26-2" + "readable-stream": "1.1.14" }, "dependencies": { "isarray": { @@ -4890,10 +5009,10 @@ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -4910,7 +5029,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "5.1.2" } }, "strip-ansi": { @@ -4919,7 +5038,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "2.1.1" } }, "strip-bom": { @@ -4928,8 +5047,8 @@ "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", "dev": true, "requires": { - "first-chunk-stream": "^1.0.0", - "is-utf8": "^0.2.0" + "first-chunk-stream": "1.0.0", + "is-utf8": "0.2.1" } }, "strip-bom-string": { @@ -4944,7 +5063,7 @@ "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", "dev": true, "requires": { - "minimist": "^1.1.0" + "minimist": "1.2.0" } }, "supports-color": { @@ -4953,7 +5072,7 @@ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "3.0.0" } }, "syntax-error": { @@ -4962,7 +5081,7 @@ "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", "dev": true, "requires": { - "acorn-node": "^1.2.0" + "acorn-node": "1.3.0" } }, "through": { @@ -4977,8 +5096,8 @@ "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", "dev": true, "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" + "readable-stream": "2.3.6", + "xtend": "4.0.1" } }, "through2-filter": { @@ -4987,8 +5106,8 @@ "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", "dev": true, "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" + "through2": "2.0.3", + "xtend": "4.0.1" } }, "tildify": { @@ -4997,7 +5116,7 @@ "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", "dev": true, "requires": { - "os-homedir": "^1.0.0" + "os-homedir": "1.0.2" } }, "time-stamp": { @@ -5012,7 +5131,7 @@ "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", "dev": true, "requires": { - "process": "~0.11.0" + "process": "0.11.10" } }, "timers-ext": { @@ -5021,8 +5140,8 @@ "integrity": "sha512-tsEStd7kmACHENhsUPaxb8Jf8/+GZZxyNFQbZD07HQOyooOa6At1rQqjffgvg7n+dxscQa9cjjMdWhJtsP2sxg==", "dev": true, "requires": { - "es5-ext": "~0.10.14", - "next-tick": "1" + "es5-ext": "0.10.42", + "next-tick": "1.0.0" } }, "to-absolute-glob": { @@ -5031,8 +5150,8 @@ "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", "dev": true, "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" + "is-absolute": "1.0.0", + "is-negated-glob": "1.0.0" } }, "to-arraybuffer": { @@ -5047,7 +5166,7 @@ "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "requires": { - "kind-of": "^3.0.2" + "kind-of": "3.2.2" }, "dependencies": { "kind-of": { @@ -5056,7 +5175,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "^1.1.5" + "is-buffer": "1.1.6" } } } @@ -5067,10 +5186,10 @@ "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "dev": true, "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "regex-not": "1.0.2", + "safe-regex": "1.1.0" } }, "to-regex-range": { @@ -5079,8 +5198,8 @@ "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", "dev": true, "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" + "is-number": "3.0.0", + "repeat-string": "1.6.1" } }, "to-through": { @@ -5089,7 +5208,7 @@ "integrity": "sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY=", "dev": true, "requires": { - "through2": "^2.0.3" + "through2": "2.0.3" } }, "travis-fold": { @@ -5110,18 +5229,18 @@ "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^3.2.0", - "glob": "^7.1.1", - "js-yaml": "^3.7.0", - "minimatch": "^3.0.4", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.8.0", - "tsutils": "^2.12.1" + "babel-code-frame": "6.26.0", + "builtin-modules": "1.1.1", + "chalk": "2.4.1", + "commander": "2.15.1", + "diff": "3.5.0", + "glob": "7.1.2", + "js-yaml": "3.11.0", + "minimatch": "3.0.4", + "resolve": "1.7.1", + "semver": "5.5.0", + "tslib": "1.9.0", + "tsutils": "2.26.2" }, "dependencies": { "commander": { @@ -5136,7 +5255,7 @@ "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", "dev": true, "requires": { - "path-parse": "^1.0.5" + "path-parse": "1.0.5" } }, "semver": { @@ -5153,7 +5272,7 @@ "integrity": "sha512-uzwnhmrSbyinPCiwfzGsOY3IulBTwoky7r83HmZdz9QNCjhSCzavkh47KLWuU0zF2F2WbpmmzoJUIEiYyd+jEQ==", "dev": true, "requires": { - "tslib": "^1.8.1" + "tslib": "1.9.0" } }, "tty-browserify": { @@ -5168,7 +5287,7 @@ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", "dev": true, "requires": { - "prelude-ls": "~1.1.2" + "prelude-ls": "1.1.2" } }, "type-detect": { @@ -5196,9 +5315,9 @@ "dev": true, "optional": true, "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" } }, "uglify-to-browserify": { @@ -5226,10 +5345,10 @@ "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", "dev": true, "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" }, "dependencies": { "extend-shallow": { @@ -5238,7 +5357,7 @@ "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { - "is-extendable": "^0.1.0" + "is-extendable": "0.1.1" } }, "set-value": { @@ -5247,10 +5366,10 @@ "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", "dev": true, "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" } } } @@ -5267,8 +5386,8 @@ "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "dev": true, "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" + "has-value": "0.3.1", + "isobject": "3.0.1" }, "dependencies": { "has-value": { @@ -5277,9 +5396,9 @@ "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "dev": true, "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" }, "dependencies": { "isobject": { @@ -5325,13 +5444,19 @@ } } }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=", + "dev": true + }, "use": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", "dev": true, "requires": { - "kind-of": "^6.0.2" + "kind-of": "6.0.2" } }, "user-home": { @@ -5375,7 +5500,7 @@ "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", "dev": true, "requires": { - "user-home": "^1.1.1" + "user-home": "1.1.1" } }, "value-or-function": { @@ -5390,12 +5515,12 @@ "integrity": "sha1-Ah+cLPlR1rk5lDyJ617lrdT9kkw=", "dev": true, "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" + "clone": "2.1.1", + "clone-buffer": "1.0.0", + "clone-stats": "1.0.0", + "cloneable-readable": "1.1.2", + "remove-trailing-separator": "1.1.0", + "replace-ext": "1.0.0" }, "dependencies": { "clone": { @@ -5424,14 +5549,14 @@ "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", "dev": true, "requires": { - "defaults": "^1.0.0", - "glob-stream": "^3.1.5", - "glob-watcher": "^0.0.6", - "graceful-fs": "^3.0.0", - "mkdirp": "^0.5.0", - "strip-bom": "^1.0.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" + "defaults": "1.0.3", + "glob-stream": "3.1.18", + "glob-watcher": "0.0.6", + "graceful-fs": "3.0.11", + "mkdirp": "0.5.1", + "strip-bom": "1.0.0", + "through2": "0.6.5", + "vinyl": "0.4.6" }, "dependencies": { "clone": { @@ -5452,10 +5577,10 @@ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "core-util-is": "1.0.2", + "inherits": "2.0.3", "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "string_decoder": "0.10.31" } }, "string_decoder": { @@ -5470,8 +5595,8 @@ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" + "readable-stream": "1.0.34", + "xtend": "4.0.1" } }, "vinyl": { @@ -5480,8 +5605,8 @@ "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", "dev": true, "requires": { - "clone": "^0.2.0", - "clone-stats": "^0.0.1" + "clone": "0.2.0", + "clone-stats": "0.0.1" } } } @@ -5492,13 +5617,13 @@ "integrity": "sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY=", "dev": true, "requires": { - "append-buffer": "^1.0.2", - "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", - "normalize-path": "^2.1.1", - "now-and-later": "^2.0.0", - "remove-bom-buffer": "^3.0.0", - "vinyl": "^2.0.0" + "append-buffer": "1.0.2", + "convert-source-map": "1.5.1", + "graceful-fs": "4.1.11", + "normalize-path": "2.1.1", + "now-and-later": "2.0.0", + "remove-bom-buffer": "3.0.0", + "vinyl": "2.1.0" }, "dependencies": { "graceful-fs": { @@ -5521,7 +5646,7 @@ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true, "requires": { - "isexe": "^2.0.0" + "isexe": "2.0.0" } }, "window-size": { @@ -5549,8 +5674,8 @@ "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", "dev": true, "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "sax": "1.2.4", + "xmlbuilder": "9.0.7" } }, "xmlbuilder": { @@ -5572,9 +5697,9 @@ "dev": true, "optional": true, "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", "window-size": "0.1.0" } } diff --git a/package.json b/package.json index ef4650c49b0..48179f02e10 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "node": ">=4.2.0" }, "devDependencies": { + "@octokit/rest": "latest", "@types/browserify": "latest", "@types/chai": "latest", "@types/convert-source-map": "latest", diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts new file mode 100644 index 00000000000..746d1946e4e --- /dev/null +++ b/scripts/open-user-pr.ts @@ -0,0 +1,63 @@ +import cp = require("child_process"); +import Octokit = require("@octokit/rest"); + +const opts = { timeout: 100_000, shell: true, stdio: "inherit" } +function runSequence(tasks: [string, string[]][]) { + for (const task of tasks) { + console.log(`${task[0]} ${task[1].join(" ")}`); + const result = cp.spawnSync(task[0], task[1], opts); + if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`); + } +} + +function padNum(number: number) { + const str = "" + number; + return str.length >= 2 ? str : "0" + str; +} + +const userName = process.env.GH_USERNAME; +const reviewers = ["weswigham", "sandersn", "mhegazy"] +const now = new Date(); +const branchName = `user-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`; +const remoteUrl = `https://github.com/${userName}/TypeScript.git`; +runSequence([ + ["git", ["checkout", "."]], // reset any changes + ["node", ["./node_modules/jake/bin/cli.js", "baseline-accept"]], // accept baselines + ["git", ["checkout", "-b", branchName]], // create a branch + ["git", ["add", "."]], // Add all changes + ["git", ["commit", "-m", `"Update user baselines"`]], // Commit all changes + ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork + ["git", ["push", "--set-upstream", "fork", branchName]] // push the branch +]); + +const gh = new Octokit(); +gh.authenticate({ + type: "token", + token: process.argv[2] +}); +gh.pullRequests.create({ + owner: process.env.TARGET_FORK, + repo: "TypeScript", + maintainer_can_modify: true, + title: `🤖 User test baselines have changed`, + head: `${userName}:${branchName}`, + base: "master", + body: +`Please review the diff and merge if no changes are unexpected. + +cc ${reviewers.map(r => "@" + r).join(" ")}`, +}).then(r => { + const num = r.data.number; + console.log(`Pull request ${num} created.`); + return gh.pullRequests.createReviewRequest({ + owner: process.env.TARGET_FORK, + repo: "TypeScript", + number: num, + reviewers, + }); +}).then(() => { + console.log(`Reviewers requested, done.`); +}).catch(e => { + console.error(e); + process.exit(1); +}); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 093c5186d7c..08f1b5c8cac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -892,6 +892,7 @@ namespace ts { function mergeSymbol(target: Symbol, source: Symbol) { if (!(target.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | target.flags) & SymbolFlags.JSContainer) { + Debug.assert(!!(target.flags & SymbolFlags.Transient)); // Javascript static-property-assignment declarations always merge, even though they are also values if (source.flags & SymbolFlags.ValueModule && target.flags & SymbolFlags.ValueModule && target.constEnumOnlyModule && !source.constEnumOnlyModule) { // reset flag when merging instantiated module into value module that has only const enums @@ -915,8 +916,12 @@ namespace ts { } if ((source.flags | target.flags) & SymbolFlags.JSContainer) { const sourceInitializer = getJSInitializerSymbol(source); - const targetInitializer = getJSInitializerSymbol(target); + let targetInitializer = getJSInitializerSymbol(target); if (sourceInitializer !== source || targetInitializer !== target) { + if (!(targetInitializer.flags & SymbolFlags.Transient)) { + const mergedInitializer = getMergedSymbol(targetInitializer); + targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer; + } mergeSymbol(targetInitializer, sourceInitializer); } } @@ -2746,7 +2751,7 @@ namespace ts { * @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible */ function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasesToMakeVisible: boolean): SymbolAccessibilityResult { - if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) { + if (symbol && enclosingDeclaration) { const initialSymbol = symbol; let meaningToLook = meaning; while (symbol) { @@ -2837,6 +2842,11 @@ namespace ts { isDeclarationVisible(declaration.parent.parent.parent)) { return addVisibleAlias(declaration, declaration.parent.parent); } + else if (isLateVisibilityPaintedStatement(declaration) // unexported top-level statement + && !hasModifier(declaration, ModifierFlags.Export) + && isDeclarationVisible(declaration.parent)) { + return addVisibleAlias(declaration, declaration); + } // Declaration is not visible return false; @@ -3113,7 +3123,15 @@ namespace ts { } if (type.flags & TypeFlags.TypeParameter || objectFlags & ObjectFlags.ClassOrInterface) { if (type.flags & TypeFlags.TypeParameter && contains(context.inferTypeParameters, type)) { - return createInferTypeNode(createTypeParameterDeclaration(getNameOfSymbolAsWritten(type.symbol))); + return createInferTypeNode(typeParameterToDeclarationWithConstraint(type as TypeParameter, context, /*constraintNode*/ undefined)); + } + if (context.flags & NodeBuilderFlags.GenerateNamesForShadowedTypeParams && + type.flags & TypeFlags.TypeParameter && + length(type.symbol.declarations) && + isTypeParameterDeclaration(type.symbol.declarations[0]) && + typeParameterShadowsNameInScope(type, context) && + !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) { + return createTypeReferenceNode(getGeneratedNameForNode((type.symbol.declarations[0] as TypeParameterDeclaration).name, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes), /*typeArguments*/ undefined); } const name = type.symbol ? symbolToName(type.symbol, context, SymbolFlags.Type, /*expectsIdentifier*/ false) : createIdentifier("?"); // Ignore constraint/default when creating a usage (as opposed to declaration) of a type parameter. @@ -3558,10 +3576,21 @@ namespace ts { return createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments); } - function typeParameterToDeclarationWithConstraint(type: TypeParameter, context: NodeBuilderContext, constraintNode: TypeNode): TypeParameterDeclaration { + function typeParameterShadowsNameInScope(type: TypeParameter, context: NodeBuilderContext) { + return !!resolveName(context.enclosingDeclaration, type.symbol.escapedName, SymbolFlags.Type, /*nameNotFoundArg*/ undefined, type.symbol.escapedName, /*isUse*/ false); + } + + function typeParameterToDeclarationWithConstraint(type: TypeParameter, context: NodeBuilderContext, constraintNode: TypeNode | undefined): TypeParameterDeclaration { const savedContextFlags = context.flags; context.flags &= ~NodeBuilderFlags.WriteTypeParametersInQualifiedName; // Avoids potential infinite loop when building for a claimspace with a generic - const name = symbolToName(type.symbol, context, SymbolFlags.Type, /*expectsIdentifier*/ true); + const shouldUseGeneratedName = + context.flags & NodeBuilderFlags.GenerateNamesForShadowedTypeParams && + type.symbol.declarations[0] && + isTypeParameterDeclaration(type.symbol.declarations[0]) && + typeParameterShadowsNameInScope(type, context); + const name = shouldUseGeneratedName + ? getGeneratedNameForNode((type.symbol.declarations[0] as TypeParameterDeclaration).name, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes) + : symbolToName(type.symbol, context, SymbolFlags.Type, /*expectsIdentifier*/ true); const defaultParameter = getDefaultFromTypeParameter(type); const defaultParameterNode = defaultParameter && typeToTypeNodeHelper(defaultParameter, context); context.flags = savedContextFlags; @@ -3694,7 +3723,17 @@ namespace ts { return typeParameterNodes; } - function symbolToTypeNode(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags): TypeQueryNode | TypeReferenceNode | ImportTypeNode { + /** + * Given A[B][C][D], finds A[B] + */ + function getTopmostIndexedAccessType(top: IndexedAccessTypeNode): IndexedAccessTypeNode { + if (isIndexedAccessTypeNode(top.objectType)) { + return getTopmostIndexedAccessType(top.objectType); + } + return top; + } + + function symbolToTypeNode(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags): TypeNode { const chain = lookupSymbolChain(symbol, context, meaning); context.flags |= NodeBuilderFlags.InInitialEntityName; @@ -3704,15 +3743,26 @@ namespace ts { const isTypeOf = meaning === SymbolFlags.Value; if (ambientModuleSymbolRegex.test(rootName)) { // module is root, must use `ImportTypeNode` - const nonRootParts = chain.length > 1 ? createEntityNameFromSymbolChain(chain, chain.length - 1, 1) : undefined; + const nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined; const typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); - return createImportTypeNode(createLiteralTypeNode(createLiteral(rootName.substring(1, rootName.length - 1))), nonRootParts, typeParameterNodes as ReadonlyArray, isTypeOf); + const lit = createLiteralTypeNode(createLiteral(rootName.substring(1, rootName.length - 1))); + if (!nonRootParts || isEntityName(nonRootParts)) { + return createImportTypeNode(lit, nonRootParts as EntityName, typeParameterNodes as ReadonlyArray, isTypeOf); + } + else { + const splitNode = getTopmostIndexedAccessType(nonRootParts); + const qualifier = (splitNode.objectType as TypeReferenceNode).typeName; + return createIndexedAccessTypeNode(createImportTypeNode(lit, qualifier, typeParameterNodes as ReadonlyArray, isTypeOf), splitNode.indexType); + } } - const entityName = createEntityNameFromSymbolChain(chain, chain.length - 1, 0); + const entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0); + if (isIndexedAccessTypeNode(entityName)) { + return entityName; // Indexed accesses can never be `typeof` + } return isTypeOf ? createTypeQueryNode(entityName) : createTypeReferenceNode(entityName, /*typeArguments*/ undefined); - function createEntityNameFromSymbolChain(chain: Symbol[], index: number, stopper: number): EntityName { + function createAccessFromSymbolChain(chain: Symbol[], index: number, stopper: number): EntityName | IndexedAccessTypeNode { const typeParameterNodes = lookupTypeParameterNodes(chain, index, context); const symbol = chain[index]; @@ -3723,10 +3773,30 @@ namespace ts { if (index === 0) { context.flags ^= NodeBuilderFlags.InInitialEntityName; } + + const parent = chain[index - 1]; + if (parent && getMembersOfSymbol(parent) && getMembersOfSymbol(parent).get(symbol.escapedName) === symbol) { + // Should use an indexed access + const LHS = createAccessFromSymbolChain(chain, index - 1, stopper); + if (isIndexedAccessTypeNode(LHS)) { + return createIndexedAccessTypeNode(LHS, createLiteralTypeNode(createLiteral(symbolName))); + } + else { + return createIndexedAccessTypeNode(createTypeReferenceNode(LHS, typeParameterNodes as ReadonlyArray), createLiteralTypeNode(createLiteral(symbolName))); + } + } + const identifier = setEmitFlags(createIdentifier(symbolName, typeParameterNodes), EmitFlags.NoAsciiEscaping); identifier.symbol = symbol; - return index > stopper ? createQualifiedName(createEntityNameFromSymbolChain(chain, index - 1, stopper), identifier) : identifier; + if (index > stopper) { + const LHS = createAccessFromSymbolChain(chain, index - 1, stopper); + if (!isEntityName(LHS)) { + return Debug.fail("Impossible construct - an export of an indexed access cannot be reachable"); + } + return createQualifiedName(LHS, identifier); + } + return identifier; } } @@ -3753,6 +3823,7 @@ namespace ts { if (index === 0) { context.flags ^= NodeBuilderFlags.InInitialEntityName; } + const identifier = setEmitFlags(createIdentifier(symbolName, typeParameterNodes), EmitFlags.NoAsciiEscaping); identifier.symbol = symbol; @@ -19309,7 +19380,7 @@ namespace ts { } const links = getNodeLinks(node); - const type = getTypeOfSymbol(node.symbol); + const type = getTypeOfSymbol(getMergedSymbol(node.symbol)); if (isTypeAny(type)) { return type; } @@ -26521,7 +26592,22 @@ namespace ts { const symbol = node && getSymbolOfNode(node); return !!(symbol && getCheckFlags(symbol) & CheckFlags.Late); }, - getJsxFactoryEntity: location => location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity + getJsxFactoryEntity: location => location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity, + getAllAccessorDeclarations(accessor: AccessorDeclaration): AllAccessorDeclarations { + accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration); + const otherKind = accessor.kind === SyntaxKind.SetAccessor ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor; + const otherAccessor = getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); + const firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; + const secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; + const setAccessor = accessor.kind === SyntaxKind.SetAccessor ? accessor : otherAccessor; + const getAccessor = accessor.kind === SyntaxKind.GetAccessor ? accessor : otherAccessor; + return { + firstAccessor, + secondAccessor, + setAccessor, + getAccessor + }; + } }; function isInHeritageClause(node: PropertyAccessEntityNameExpression) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4788361a9d3..1f75ee94c0e 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1620,10 +1620,12 @@ namespace ts { createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array"); } } - else { - const outDir = raw.compilerOptions && raw.compilerOptions.outDir; - if (outDir) { - excludeSpecs = [outDir]; + else if (raw.compilerOptions) { + const outDir = raw.compilerOptions.outDir; + const declarationDir = raw.compilerOptions.declarationDir; + + if (outDir || declarationDir) { + excludeSpecs = [outDir, declarationDir].filter(d => !!d); } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ec95d6be17e..1ce6d2d8e98 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -319,8 +319,8 @@ namespace ts { } /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ - export function findIndex(array: ReadonlyArray, predicate: (element: T, index: number) => boolean): number { - for (let i = 0; i < array.length; i++) { + export function findIndex(array: ReadonlyArray, predicate: (element: T, index: number) => boolean, startIndex?: number): number { + for (let i = startIndex || 0; i < array.length; i++) { if (predicate(array[i], i)) { return i; } @@ -959,6 +959,21 @@ namespace ts { return to; } + /** + * Appends a range of value to begin of an array, returning the array. + * + * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array + * is created if `value` was appended. + * @param from The values to append to the array. If `from` is `undefined`, nothing is + * appended. If an element of `from` is `undefined`, that element is not appended. + */ + export function prependRange(to: T[], from: ReadonlyArray | undefined): T[] | undefined { + if (from === undefined || from.length === 0) return to; + if (to === undefined) return from.slice(); + to.unshift(...from); + return to; + } + /** * @return Whether the value was added. */ @@ -2399,20 +2414,24 @@ namespace ts { return ["", ...relative, ...components]; } + export function getRelativePathFromFile(from: string, to: string, getCanonicalFileName: GetCanonicalFileName) { + return ensurePathIsNonModuleName(getRelativePathFromDirectory(getDirectoryPath(from), to, getCanonicalFileName)); + } + /** * Gets a relative path that can be used to traverse between `from` and `to`. */ - export function getRelativePath(from: string, to: string, ignoreCase: boolean): string; + export function getRelativePathFromDirectory(from: string, to: string, ignoreCase: boolean): string; /** * Gets a relative path that can be used to traverse between `from` and `to`. */ // tslint:disable-next-line:unified-signatures - export function getRelativePath(from: string, to: string, getCanonicalFileName: GetCanonicalFileName): string; - export function getRelativePath(from: string, to: string, getCanonicalFileNameOrIgnoreCase: GetCanonicalFileName | boolean) { - Debug.assert((getRootLength(from) > 0) === (getRootLength(to) > 0), "Paths must either both be absolute or both be relative"); + export function getRelativePathFromDirectory(fromDirectory: string, to: string, getCanonicalFileName: GetCanonicalFileName): string; + export function getRelativePathFromDirectory(fromDirectory: string, to: string, getCanonicalFileNameOrIgnoreCase: GetCanonicalFileName | boolean) { + Debug.assert((getRootLength(fromDirectory) > 0) === (getRootLength(to) > 0), "Paths must either both be absolute or both be relative"); const getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : identity; const ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false; - const pathComponents = getPathComponentsRelativeTo(from, to, ignoreCase ? equateStringsCaseInsensitive : equateStringsCaseSensitive, getCanonicalFileName); + const pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? equateStringsCaseInsensitive : equateStringsCaseSensitive, getCanonicalFileName); return getPathFromPathComponents(pathComponents); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 783579e2232..5b7990cfc86 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4253,5 +4253,17 @@ "Convert all 'require' to 'import'": { "category": "Message", "code": 95048 + }, + "Move to a new file": { + "category": "Message", + "code": 95049 + }, + "Remove unreachable code": { + "category": "Message", + "code": 95050 + }, + "Remove all unreachable code": { + "category": "Message", + "code": 95051 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index b4ff2617a0d..f4d1d85456d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1132,6 +1132,7 @@ namespace ts { } function emitMethodSignature(node: MethodSignature) { + pushNameGenerationScope(node); emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emit(node.name); @@ -1140,6 +1141,7 @@ namespace ts { emitParameters(node, node.parameters); emitTypeAnnotation(node.type); writeSemicolon(); + popNameGenerationScope(node); } function emitMethodDeclaration(node: MethodDeclaration) { @@ -1167,15 +1169,18 @@ namespace ts { } function emitCallSignature(node: CallSignatureDeclaration) { + pushNameGenerationScope(node); emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); writeSemicolon(); + popNameGenerationScope(node); } function emitConstructSignature(node: ConstructSignatureDeclaration) { + pushNameGenerationScope(node); emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); writeKeyword("new"); @@ -1184,6 +1189,7 @@ namespace ts { emitParameters(node, node.parameters); emitTypeAnnotation(node.type); writeSemicolon(); + popNameGenerationScope(node); } function emitIndexSignature(node: IndexSignatureDeclaration) { @@ -1216,12 +1222,14 @@ namespace ts { } function emitFunctionType(node: FunctionTypeNode) { + pushNameGenerationScope(node); emitTypeParameters(node, node.typeParameters); emitParametersForArrow(node, node.parameters); writeSpace(); writePunctuation("=>"); writeSpace(); emit(node.type); + popNameGenerationScope(node); } function emitJSDocFunctionType(node: JSDocFunctionType) { @@ -1248,6 +1256,7 @@ namespace ts { } function emitConstructorType(node: ConstructorTypeNode) { + pushNameGenerationScope(node); writeKeyword("new"); writeSpace(); emitTypeParameters(node, node.typeParameters); @@ -1256,6 +1265,7 @@ namespace ts { writePunctuation("=>"); writeSpace(); emit(node.type); + popNameGenerationScope(node); } function emitTypeQuery(node: TypeQueryNode) { @@ -3241,7 +3251,7 @@ namespace ts { if (isGeneratedIdentifier(node)) { return generateName(node); } - else if (isIdentifier(node) && (nodeIsSynthesized(node) || !node.parent)) { + else if (isIdentifier(node) && (nodeIsSynthesized(node) || !node.parent || !currentSourceFile || (node.parent && currentSourceFile && getSourceFileOfNode(node) !== getOriginalNode(currentSourceFile)))) { return idText(node); } else if (node.kind === SyntaxKind.StringLiteral && (node).textSourceNode) { @@ -3415,7 +3425,7 @@ namespace ts { if ((name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask) === GeneratedIdentifierFlags.Node) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name)); + return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -3425,9 +3435,9 @@ namespace ts { } } - function generateNameCached(node: Node) { + function generateNameCached(node: Node, flags?: GeneratedIdentifierFlags) { const nodeId = getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); } /** @@ -3444,7 +3454,7 @@ namespace ts { * Returns a value indicating whether a name is unique globally or within the current file. */ function isFileLevelUniqueName(name: string) { - return ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName); + return currentSourceFile ? ts.isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true; } /** @@ -3504,10 +3514,15 @@ namespace ts { * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic?: boolean): string { + function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic?: boolean, scoped?: boolean): string { if (optimistic) { if (checkFn(baseName)) { - generatedNames.set(baseName, true); + if (scoped) { + reserveNameInNestedScopes(baseName); + } + else { + generatedNames.set(baseName, true); + } return baseName; } } @@ -3519,7 +3534,12 @@ namespace ts { while (true) { const generatedName = baseName + i; if (checkFn(generatedName)) { - generatedNames.set(generatedName, true); + if (scoped) { + reserveNameInNestedScopes(generatedName); + } + else { + generatedNames.set(generatedName, true); + } return generatedName; } i++; @@ -3573,10 +3593,15 @@ namespace ts { /** * Generates a unique name from a node. */ - function generateNameForNode(node: Node): string { + function generateNameForNode(node: Node, flags?: GeneratedIdentifierFlags): string { switch (node.kind) { case SyntaxKind.Identifier: - return makeUniqueName(getTextOfNode(node)); + return makeUniqueName( + getTextOfNode(node), + isUniqueName, + !!(flags & GeneratedIdentifierFlags.Optimistic), + !!(flags & GeneratedIdentifierFlags.ReservedInNestedScopes) + ); case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: return generateNameForModuleOrEnum(node); @@ -3611,7 +3636,8 @@ namespace ts { return makeUniqueName( idText(name), (name.autoGenerateFlags & GeneratedIdentifierFlags.FileLevel) ? isFileLevelUniqueName : isUniqueName, - !!(name.autoGenerateFlags & GeneratedIdentifierFlags.Optimistic) + !!(name.autoGenerateFlags & GeneratedIdentifierFlags.Optimistic), + !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes) ); } @@ -3631,7 +3657,7 @@ namespace ts { // if "node" is a different generated name (having a different // "autoGenerateId"), use it and stop traversing. if (isIdentifier(node) - && node.autoGenerateFlags === GeneratedIdentifierFlags.Node + && !!(node.autoGenerateFlags & GeneratedIdentifierFlags.Node) && node.autoGenerateId !== autoGenerateId) { break; } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 5069b0b0695..93bddfb5331 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -93,12 +93,18 @@ namespace ts { return node; } - function createStringLiteral(text: string): StringLiteral { + export function createStringLiteral(text: string): StringLiteral { const node = createSynthesizedNode(SyntaxKind.StringLiteral); node.text = text; return node; } + export function createRegularExpressionLiteral(text: string): RegularExpressionLiteral { + const node = createSynthesizedNode(SyntaxKind.RegularExpressionLiteral); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode: PropertyNameLiteral): StringLiteral { const node = createStringLiteral(getTextOfIdentifierOrLiteral(sourceNode)); node.textSourceNode = sourceNode; @@ -186,9 +192,11 @@ namespace ts { } /** Create a unique name generated for a node. */ - export function getGeneratedNameForNode(node: Node): Identifier { - const name = createIdentifier(""); - name.autoGenerateFlags = GeneratedIdentifierFlags.Node; + export function getGeneratedNameForNode(node: Node): Identifier; + /* @internal */ export function getGeneratedNameForNode(node: Node, flags: GeneratedIdentifierFlags): Identifier; // tslint:disable-line unified-signatures + export function getGeneratedNameForNode(node: Node, flags?: GeneratedIdentifierFlags): Identifier { + const name = createIdentifier(isIdentifier(node) ? idText(node) : ""); + name.autoGenerateFlags = GeneratedIdentifierFlags.Node | flags; name.autoGenerateId = nextAutoGenerateId; name.original = node; nextAutoGenerateId++; @@ -1497,6 +1505,13 @@ namespace ts { return block; } + /* @internal */ + export function createExpressionStatement(expression: Expression): ExpressionStatement { + const node = createSynthesizedNode(SyntaxKind.ExpressionStatement); + node.expression = expression; + return node; + } + export function updateBlock(node: Block, statements: ReadonlyArray) { return node.statements !== statements ? updateNode(createBlock(statements, node.multiLine), node) @@ -1523,9 +1538,7 @@ namespace ts { } export function createStatement(expression: Expression) { - const node = createSynthesizedNode(SyntaxKind.ExpressionStatement); - node.expression = parenthesizeExpressionForExpressionStatement(expression); - return node; + return createExpressionStatement(parenthesizeExpressionForExpressionStatement(expression)); } export function updateStatement(node: ExpressionStatement, expression: Expression) { @@ -4242,6 +4255,7 @@ namespace ts { switch (member.kind) { case SyntaxKind.TypeQuery: case SyntaxKind.TypeOperator: + case SyntaxKind.InferType: return createParenthesizedType(member); } return parenthesizeElementTypeMember(member); diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index d0f3ddc9d89..69a4da1d538 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -9,7 +9,13 @@ namespace ts { return result.diagnostics; } - const declarationEmitNodeBuilderFlags = NodeBuilderFlags.MultilineObjectLiterals | TypeFormatFlags.WriteClassExpressionAsTypeLiteral | NodeBuilderFlags.UseTypeOfFunction | NodeBuilderFlags.UseStructuralFallback | NodeBuilderFlags.AllowEmptyTuple; + const declarationEmitNodeBuilderFlags = + NodeBuilderFlags.MultilineObjectLiterals | + TypeFormatFlags.WriteClassExpressionAsTypeLiteral | + NodeBuilderFlags.UseTypeOfFunction | + NodeBuilderFlags.UseStructuralFallback | + NodeBuilderFlags.AllowEmptyTuple | + NodeBuilderFlags.GenerateNamesForShadowedTypeParams; /** * Transforms a ts file into a .d.ts file @@ -28,7 +34,7 @@ namespace ts { let enclosingDeclaration: Node; let necessaryTypeRefernces: Map; let lateMarkedStatements: LateVisibilityPaintedStatement[]; - let lateStatementReplacementMap: Map; + let lateStatementReplacementMap: Map>; let suppressNewDiagnosticContexts: boolean; const symbolTracker: SymbolTracker = { @@ -95,6 +101,7 @@ namespace ts { } function trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { + if (symbol.flags & SymbolFlags.TypeParameter) return; handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true)); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } @@ -155,13 +162,13 @@ namespace ts { [], [createModifier(SyntaxKind.DeclareKeyword)], createLiteral(getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), - createModuleBlock(setTextRange(createNodeArray(filterCandidateImports(statements)), sourceFile.statements)) + createModuleBlock(setTextRange(createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)) )], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; const updated = visitNodes(sourceFile.statements, visitDeclarationStatements); - return updateSourceFileNode(sourceFile, filterCandidateImports(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + return updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); } ), mapDefined(node.prepends, prepend => { if (prepend.kind === SyntaxKind.InputFiles) { @@ -196,7 +203,7 @@ namespace ts { const referenceVisitor = mapReferencesIntoArray(references, outputFilePath); refs.forEach(referenceVisitor); const statements = visitNodes(node.statements, visitDeclarationStatements); - let combinedStatements = setTextRange(createNodeArray(filterCandidateImports(statements)), node.statements); + let combinedStatements = setTextRange(createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements); const emittedImports = filter(combinedStatements, isAnyImportSyntax); if (isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) { combinedStatements = setTextRange(createNodeArray([...combinedStatements, createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([]), /*moduleSpecifier*/ undefined)]), combinedStatements); @@ -258,7 +265,7 @@ namespace ts { forEach(sourceFile.referencedFiles, f => { const elem = tryResolveScriptReference(host, sourceFile, f); if (elem) { - ret.set("" + getNodeId(elem), elem); + ret.set("" + getOriginalNodeId(elem), elem); } }); return ret; @@ -538,7 +545,7 @@ namespace ts { // Nothing visible } - function filterCandidateImports(statements: NodeArray): NodeArray { + function transformAndReplaceLatePaintedStatements(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: @@ -553,65 +560,50 @@ 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 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 - unconsideredStatements.push(i); - 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!"); + return Debug.fail(`Late replaced statement was found which is not handled by the declaration transformer!: ${(ts as any).SyntaxKind ? (ts as any).SyntaxKind[(i as any).kind] : (i as any).kind}`); } + const result = transformTopLevelDeclaration(i, /*privateDeclaration*/ true); + lateStatementReplacementMap.set("" + getOriginalNodeId(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 - 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 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; + function visitLateVisibilityMarkedStatements(statement: Statement) { + if (isLateVisibilityPaintedStatement(statement)) { + const key = "" + getOriginalNodeId(statement); + if (lateStatementReplacementMap.has(key)) { + const result = lateStatementReplacementMap.get(key); + lateStatementReplacementMap.delete(key); + if (result && isSourceFile(statement.parent)) { + if (isArray(result) ? some(result, needsScopeMarker) : needsScopeMarker(result)) { + // 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; + } + if (isArray(result) ? some(result, isExternalModuleIndicator) : isExternalModuleIndicator(result)) { + resultHasExternalModuleIndicator = true; + } + } + return result; } - return result; } - else { - return getParseTreeNode(statement) ? undefined : statement; - } - } - else { return statement; } } + function isExternalModuleIndicator(result: LateVisibilityPaintedStatement) { + // Exported top-level member indicates moduleness + return isAnyImportOrReExport(result) || isExportAssignment(result) || hasModifier(result, ModifierFlags.Export); + } + + function needsScopeMarker(result: LateVisibilityPaintedStatement) { + return !isAnyImportOrReExport(result) && !isExportAssignment(result) && !hasModifier(result, ModifierFlags.Export) && !isAmbientModule(result); + } + function visitDeclarationSubtree(input: Node): VisitResult { if (shouldStripInternal(input)) return; if (isDeclaration(input)) { @@ -866,13 +858,22 @@ namespace ts { return [statement, updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } - case SyntaxKind.ImportEqualsDeclaration: + } + + const result = transformTopLevelDeclaration(input); + // Don't actually transform yet; just leave as original node - will be elided/swapped by late pass + lateStatementReplacementMap.set("" + getOriginalNodeId(input), result); + return input; + } + + function transformTopLevelDeclaration(input: LateVisibilityPaintedStatement, isPrivate?: boolean) { + if (shouldStripInternal(input)) return; + switch (input.kind) { + case SyntaxKind.ImportEqualsDeclaration: { + return transformImportEqualsDeclaration(input); + } 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 - lateMarkedStatements = lateMarkedStatements || []; - pushIfUnique(lateMarkedStatements, input); - return input; + return transformImportDeclaration(input); } } if (isDeclaration(input) && isDeclarationAndNotVisible(input)) return; @@ -885,21 +886,20 @@ namespace ts { previousEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = input as Declaration; } - let previousNeedsDeclare: typeof needsDeclare; const canProdiceDiagnostic = canProduceDiagnostics(input); const oldDiag = getSymbolAccessibilityDiagnostic; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(input as DeclarationDiagnosticProducing); } - let oldPossibleImports: typeof lateMarkedStatements; + const previousNeedsDeclare = needsDeclare; switch (input.kind) { case SyntaxKind.TypeAliasDeclaration: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(updateTypeAliasDeclaration( input, /*decorators*/ undefined, - ensureModifiers(input), + ensureModifiers(input, isPrivate), input.name, visitNodes(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), visitNode(input.type, visitDeclarationSubtree, isTypeNode) @@ -908,7 +908,7 @@ namespace ts { return cleanup(updateInterfaceDeclaration( input, /*decorators*/ undefined, - ensureModifiers(input), + ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), @@ -920,7 +920,7 @@ namespace ts { return cleanup(updateFunctionDeclaration( input, /*decorators*/ undefined, - ensureModifiers(input), + ensureModifiers(input, isPrivate), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), @@ -930,16 +930,13 @@ namespace ts { )); } case SyntaxKind.ModuleDeclaration: { - previousNeedsDeclare = needsDeclare; needsDeclare = false; - oldPossibleImports = lateMarkedStatements; - lateMarkedStatements = undefined; const inner = input.body; if (inner && inner.kind === SyntaxKind.ModuleBlock) { const statements = visitNodes(inner.statements, visitDeclarationStatements); - const body = updateModuleBlock(inner, filterCandidateImports(statements)); + const body = updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements)); needsDeclare = previousNeedsDeclare; - const mods = ensureModifiers(input); + const mods = ensureModifiers(input, isPrivate); return cleanup(updateModuleDeclaration( input, /*decorators*/ undefined, @@ -950,19 +947,24 @@ namespace ts { } else { needsDeclare = previousNeedsDeclare; - const mods = ensureModifiers(input); + const mods = ensureModifiers(input, isPrivate); needsDeclare = false; + visitNode(inner, visitDeclarationStatements); + // eagerly transform nested namespaces (the nesting doesn't need any elision or painting done) + const id = "" + getOriginalNodeId(inner); + const body = lateStatementReplacementMap.get(id); + lateStatementReplacementMap.delete(id); return cleanup(updateModuleDeclaration( input, /*decorators*/ undefined, mods, input.name, - visitNode(inner, visitDeclarationStatements) + body as ModuleBody )); } } case SyntaxKind.ClassDeclaration: { - const modifiers = createNodeArray(ensureModifiers(input)); + const modifiers = createNodeArray(ensureModifiers(input, isPrivate)); const typeParameters = ensureTypeParams(input, input.typeParameters); const ctor = getFirstConstructorWithBody(input); let parameterProperties: PropertyDeclaration[]; @@ -1055,12 +1057,10 @@ namespace ts { } } case SyntaxKind.VariableStatement: { - 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); + return cleanup(transformVariableStatement(input, isPrivate)); } case SyntaxKind.EnumDeclaration: { - return cleanup(updateEnumDeclaration(input, /*decorators*/ undefined, createNodeArray(ensureModifiers(input)), input.name, createNodeArray(mapDefined(input.members, m => { + return cleanup(updateEnumDeclaration(input, /*decorators*/ undefined, createNodeArray(ensureModifiers(input, isPrivate)), input.name, createNodeArray(mapDefined(input.members, m => { if (shouldStripInternal(m)) return; // Rewrite enum values to their constants, if available const constValue = resolver.getConstantValue(m); @@ -1068,31 +1068,23 @@ namespace ts { })))); } } - // Anything left unhandled is an error, so this should be unreachable return Debug.assertNever(input, `Unhandled top-level node in declaration emit: ${(ts as any).SyntaxKind[(input as any).kind]}`); - function cleanup(returnValue: T | undefined): T { + function cleanup(node: T | undefined): T { if (isEnclosingDeclaration(input)) { enclosingDeclaration = previousEnclosingDeclaration; } - if (input.kind === SyntaxKind.ModuleDeclaration) { - needsDeclare = previousNeedsDeclare; - lateMarkedStatements = concatenate(oldPossibleImports, lateMarkedStatements); - } if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - 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; - } + if (input.kind === SyntaxKind.ModuleDeclaration) { + needsDeclare = previousNeedsDeclare; } - if (returnValue === input) { - return returnValue; + if (node as Node === input) { + return node; } - return returnValue && setOriginalNode(preserveJsDoc(returnValue, input), input); + return node && setOriginalNode(preserveJsDoc(node, input), input); } } @@ -1175,7 +1167,7 @@ namespace ts { } function ensureAccessor(node: AccessorDeclaration): PropertyDeclaration | undefined { - const accessors = getAllAccessorDeclarations((node.parent as ClassDeclaration).members, node); + const accessors = resolver.getAllAccessorDeclarations(node); if (node.kind !== accessors.firstAccessor.kind) { return; } diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 76a7219b758..2685f1da88d 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -529,7 +529,7 @@ namespace ts { createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList(taggedTemplateStringDeclarations))); } - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updateSourceFileNode( node, @@ -836,7 +836,7 @@ namespace ts { setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps); statements.push(statement); - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); const block = createBlock(setTextRange(createNodeArray(statements), /*location*/ node.members), /*multiLine*/ true); setEmitFlags(block, EmitFlags.NoComments); @@ -979,7 +979,7 @@ namespace ts { ); } - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); if (constructor) { prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false); @@ -1894,7 +1894,7 @@ namespace ts { } const lexicalEnvironment = context.endLexicalEnvironment(); - addRange(statements, lexicalEnvironment); + prependRange(statements, lexicalEnvironment); prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false); @@ -2712,7 +2712,7 @@ namespace ts { if (loopOutParameters.length) { copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); } - addRange(statements, lexicalEnvironment); + prependRange(statements, lexicalEnvironment); loopBody = createBlock(statements, /*multiline*/ true); } @@ -3309,10 +3309,12 @@ namespace ts { // expression, but we will restore them later to preserve comments and source maps. const body = cast(cast(skipOuterExpressions(node.expression), isArrowFunction).body, isBlock); - // The class statements are the statements generated by visiting the first statement of the + // The class statements are the statements generated by visiting the first statement with initializer of the // body (1), while all other statements are added to remainingStatements (2) - const classStatements = visitNodes(body.statements, visitor, isStatement, 0, 1); - const remainingStatements = visitNodes(body.statements, visitor, isStatement, 1, body.statements.length - 1); + const isVariableStatementWithInitializer = (stmt: Statement) => isVariableStatement(stmt) && !!firstOrUndefined(stmt.declarationList.declarations).initializer; + const bodyStatements = visitNodes(body.statements, visitor, isStatement); + const classStatements = filter(bodyStatements, isVariableStatementWithInitializer); + const remainingStatements = filter(bodyStatements, stmt => !isVariableStatementWithInitializer(stmt)); const varStatement = cast(firstOrUndefined(classStatements), isVariableStatement); // We know there is only one variable declaration here as we verified this in an @@ -3324,6 +3326,7 @@ namespace ts { // we see as an assignment, for example: // // (function () { + // var C_1; // var C = C_1 = (function () { // function C() { // } @@ -3332,7 +3335,6 @@ namespace ts { // }()); // C = C_1 = __decorate([dec], C); // return C; - // var C_1; // }()) // const aliasAssignment = tryCast(initializer, isAssignmentExpression); diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index c61809b64e0..0316c90b250 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -412,7 +412,7 @@ namespace ts { ) ); - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); const block = createBlock(statements, /*multiLine*/ true); setTextRange(block, node.body); @@ -443,7 +443,7 @@ namespace ts { const declarations = endLexicalEnvironment(); if (some(declarations)) { const block = convertToFunctionBody(expression); - result = updateBlock(block, setTextRange(createNodeArray(concatenate(block.statements, declarations)), block.statements)); + result = updateBlock(block, setTextRange(createNodeArray(concatenate(declarations, block.statements)), block.statements)); } else { result = expression; diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index eec1463433a..fa5ec555ed1 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -663,7 +663,7 @@ namespace ts { ) ); - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); const block = updateBlock(node.body, statements); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. @@ -692,11 +692,11 @@ namespace ts { statementOffset = addPrologue(statements, body.statements, /*ensureUseStrict*/ false, visitor); } addRange(statements, appendObjectRestAssignmentsIfNeeded(/*statements*/ undefined, node)); - const trailingStatements = endLexicalEnvironment(); - if (statementOffset > 0 || some(statements) || some(trailingStatements)) { + const leadingStatements = endLexicalEnvironment(); + if (statementOffset > 0 || some(statements) || some(leadingStatements)) { const block = convertToFunctionBody(body, /*multiLine*/ true); + prependRange(statements, leadingStatements); addRange(statements, block.statements.slice(statementOffset)); - addRange(statements, trailingStatements); return updateBlock(block, setTextRange(createNodeArray(statements), block.statements)); } return body; diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index a1d610280c0..04d131b20a9 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -586,7 +586,7 @@ namespace ts { transformAndEmitStatements(body.statements, statementOffset); const buildResult = build(); - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); statements.push(createReturn(buildResult)); // Restore previous generator state diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 503d662ad58..dbc29215e40 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -97,7 +97,7 @@ namespace ts { append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement)); addRange(statements, visitNodes(node.statements, sourceElementVisitor, isStatement, statementOffset)); addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); const updated = updateSourceFileNode(node, setTextRange(createNodeArray(statements), node.statements)); if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) { @@ -426,7 +426,7 @@ namespace ts { // End the lexical environment for the module body // and merge any new lexical declarations. - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); const body = createBlock(statements, /*multiLine*/ true); if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) { diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 047b552415d..0e6f5afad18 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -257,7 +257,7 @@ namespace ts { // We emit hoisted variables early to align roughly with our previous emit output. // Two key differences in this approach are: // - Temporary variables will appear at the top rather than at the bottom of the file - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); const exportStarFunction = addExportStarIfNeeded(statements); const moduleObject = createObjectLiteral([ diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 862b79dbf24..b358b13b502 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -669,7 +669,7 @@ namespace ts { setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps); statements.push(statement); - addRange(statements, context.endLexicalEnvironment()); + prependRange(statements, context.endLexicalEnvironment()); const iife = createImmediatelyInvokedArrowFunction(statements); setEmitFlags(iife, EmitFlags.TypeScriptClassWrapper); @@ -2685,8 +2685,9 @@ namespace ts { const statements: Statement[] = []; startLexicalEnvironment(); - addRange(statements, map(node.members, transformEnumMember)); - addRange(statements, endLexicalEnvironment()); + const members = map(node.members, transformEnumMember); + prependRange(statements, endLexicalEnvironment()); + addRange(statements, members); currentNamespaceContainerName = savedCurrentNamespaceLocalName; return createBlock( @@ -3000,7 +3001,7 @@ namespace ts { statementsLocation = moveRangePos(moduleBlock.statements, -1); } - addRange(statements, endLexicalEnvironment()); + prependRange(statements, endLexicalEnvironment()); currentNamespaceContainerName = savedCurrentNamespaceContainerName; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0ef9f4e5bea..427400e346c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -538,7 +538,7 @@ namespace ts { Abstract = 1 << 7, // Class/Method/ConstructSignature Async = 1 << 8, // Property/Method/Function Default = 1 << 9, // Function/Class (export default declaration) - Const = 1 << 11, // Variable declaration + Const = 1 << 11, // Const enum HasComputedFlags = 1 << 29, // Modifier flags have been computed AccessibilityModifier = Public | Private | Protected, @@ -3075,7 +3075,7 @@ namespace ts { // Options NoTruncation = 1 << 0, // Don't truncate result WriteArrayAsGenericType = 1 << 1, // Write Array instead T[] - // empty space + GenerateNamesForShadowedTypeParams = 1 << 2, // When a type parameter T is shadowing another T, generate a name for it so it can still be referenced UseStructuralFallback = 1 << 3, // When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible // empty space WriteTypeArgumentsOfSignature = 1 << 5, // Write the type arguments instead of type parameters of the signature @@ -3253,18 +3253,31 @@ namespace ts { /* @internal */ export type AnyImportOrReExport = AnyImportSyntax | ExportDeclaration; + /* @internal */ + export interface ValidImportTypeNode extends ImportTypeNode { + argument: LiteralTypeNode & { literal: StringLiteral }; + } + /* @internal */ export type AnyValidImportOrReExport = | (ImportDeclaration | ExportDeclaration) & { moduleSpecifier: StringLiteral } | ImportEqualsDeclaration & { moduleReference: ExternalModuleReference & { expression: StringLiteral } } | RequireOrImportCall - | ImportTypeNode & { argument: LiteralType }; + | ValidImportTypeNode; /* @internal */ export type RequireOrImportCall = CallExpression & { arguments: [StringLiteralLike] }; /* @internal */ - export type LateVisibilityPaintedStatement = AnyImportSyntax | VariableStatement; + export type LateVisibilityPaintedStatement = + | AnyImportSyntax + | VariableStatement + | ClassDeclaration + | FunctionDeclaration + | ModuleDeclaration + | TypeAliasDeclaration + | InterfaceDeclaration + | EnumDeclaration; /* @internal */ export interface SymbolVisibilityResult { @@ -3279,6 +3292,14 @@ namespace ts { errorModuleName?: string; // If the symbol is not visible from module, module's name } + /* @internal */ + export interface AllAccessorDeclarations { + firstAccessor: AccessorDeclaration; + secondAccessor: AccessorDeclaration; + getAccessor: AccessorDeclaration; + setAccessor: AccessorDeclaration; + } + /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator metadata */ /* @internal */ export enum TypeReferenceSerializationKind { @@ -3335,6 +3356,7 @@ namespace ts { getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[]; isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean; getJsxFactoryEntity(location?: Node): EntityName; + getAllAccessorDeclarations(declaration: AccessorDeclaration): AllAccessorDeclarations; } export const enum SymbolFlags { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7afc862bba4..29bd38803d0 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -542,6 +542,12 @@ namespace ts { case SyntaxKind.ImportDeclaration: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.VariableStatement: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: return true; default: return false; @@ -1722,6 +1728,10 @@ namespace ts { } export function importFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport { + return tryGetImportFromModuleSpecifier(node) || Debug.fail(Debug.showSyntaxKind(node.parent)); + } + + export function tryGetImportFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport | undefined { switch (node.parent.kind) { case SyntaxKind.ImportDeclaration: case SyntaxKind.ExportDeclaration: @@ -1731,9 +1741,10 @@ namespace ts { case SyntaxKind.CallExpression: return node.parent as AnyValidImportOrReExport; case SyntaxKind.LiteralType: - return cast(node.parent.parent, isImportTypeNode) as ImportTypeNode & { argument: LiteralType }; + Debug.assert(isStringLiteral(node)); + return tryCast(node.parent.parent, isImportTypeNode) as ValidImportTypeNode | undefined; default: - return Debug.fail(Debug.showSyntaxKind(node.parent)); + return undefined; } } @@ -3008,13 +3019,6 @@ namespace ts { return id.originalKeywordKind === SyntaxKind.ThisKeyword; } - export interface AllAccessorDeclarations { - firstAccessor: AccessorDeclaration; - secondAccessor: AccessorDeclaration; - getAccessor: AccessorDeclaration; - setAccessor: AccessorDeclaration; - } - export function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): AllAccessorDeclarations { let firstAccessor: AccessorDeclaration; let secondAccessor: AccessorDeclaration; @@ -4890,6 +4894,11 @@ namespace ts { return node.kind === SyntaxKind.IndexSignature; } + /* @internal */ + export function isGetOrSetAccessorDeclaration(node: Node): node is AccessorDeclaration { + return node.kind === SyntaxKind.SetAccessor || node.kind === SyntaxKind.GetAccessor; + } + // Type export function isTypePredicateNode(node: Node): node is TypePredicateNode { diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 284d870caa1..6c1864cd627 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -145,7 +145,7 @@ namespace ts { statements = setTextRange(createNodeArray([createStatement(createLiteral("use strict")), ...statements]), statements); } const declarations = context.endLexicalEnvironment(); - return setTextRange(createNodeArray(concatenate(statements, declarations)), statements); + return setTextRange(createNodeArray(concatenate(declarations, statements)), statements); } /** @@ -1468,8 +1468,8 @@ namespace ts { } return isNodeArray(statements) - ? setTextRange(createNodeArray(concatenate(statements, declarations)), statements) - : addRange(statements, declarations); + ? setTextRange(createNodeArray(concatenate(declarations, statements)), statements) + : prependRange(statements, declarations); } /** diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 1ffa2fc63a7..91a95e22c89 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -12,6 +12,10 @@ const enum CompilerTestType { Test262 } +interface CompilerFileBasedTest extends Harness.FileBasedTest { + payload?: Harness.TestCaseParser.TestCaseContent; +} + class CompilerBaselineRunner extends RunnerBase { private basePath = "tests/cases"; private testSuiteName: TestRunnerKind; @@ -42,7 +46,8 @@ class CompilerBaselineRunner extends RunnerBase { } public enumerateTestFiles() { - return this.enumerateFiles(this.basePath, /\.tsx?$/, { recursive: true }); + // see also: `enumerateTestFiles` in tests/webTestServer.ts + return this.enumerateFiles(this.basePath, /\.tsx?$/, { recursive: true }).map(CompilerTest.getConfigurations); } public initializeTests() { @@ -52,24 +57,32 @@ class CompilerBaselineRunner extends RunnerBase { }); // this will set up a series of describe/it blocks to run between the setup and cleanup phases - const files = this.tests.length > 0 ? this.tests : this.enumerateTestFiles(); - files.forEach(file => { this.checkTestCodeOutput(vpath.normalizeSeparators(file)); }); + const files = this.tests.length > 0 ? this.tests : Harness.IO.enumerateTestFiles(this); + files.forEach(test => { + const file = typeof test === "string" ? test : test.file; + this.checkTestCodeOutput(vpath.normalizeSeparators(file), typeof test === "string" ? CompilerTest.getConfigurations(test) : test); + }); }); } - public checkTestCodeOutput(fileName: string) { - for (const { name, payload } of CompilerTest.getConfigurations(fileName)) { - describe(`${this.testSuiteName} tests for ${fileName}${name ? ` (${name})` : ``}`, () => { - this.runSuite(fileName, payload); + public checkTestCodeOutput(fileName: string, test?: CompilerFileBasedTest) { + if (test && test.configurations) { + test.configurations.forEach(configuration => { + describe(`${this.testSuiteName} tests for ${fileName}${configuration ? ` (${Harness.getFileBasedTestConfigurationDescription(configuration)})` : ``}`, () => { + this.runSuite(fileName, test, configuration); + }); }); } + describe(`${this.testSuiteName} tests for ${fileName}}`, () => { + this.runSuite(fileName, test); + }); } - private runSuite(fileName: string, testCaseContent: Harness.TestCaseParser.TestCaseContent) { + private runSuite(fileName: string, test?: CompilerFileBasedTest, configuration?: Harness.FileBasedTestConfiguration) { // Mocha holds onto the closure environment of the describe callback even after the test is done. // Everything declared here should be cleared out in the "after" callback. let compilerTest: CompilerTest | undefined; - before(() => { compilerTest = new CompilerTest(fileName, testCaseContent); }); + before(() => { compilerTest = new CompilerTest(fileName, test && test.payload, configuration); }); it(`Correct errors for ${fileName}`, () => { compilerTest.verifyDiagnostics(); }); it(`Correct module resolution tracing for ${fileName}`, () => { compilerTest.verifyModuleResolution(); }); it(`Correct sourcemap content for ${fileName}`, () => { compilerTest.verifySourceMapRecord(); }); @@ -97,11 +110,6 @@ class CompilerBaselineRunner extends RunnerBase { } } -interface CompilerTestConfiguration { - name: string; - payload: Harness.TestCaseParser.TestCaseContent; -} - class CompilerTest { private fileName: string; private justName: string; @@ -116,10 +124,20 @@ class CompilerTest { // equivalent to other files on the file system not directly passed to the compiler (ie things that are referenced by other files) private otherFiles: Harness.Compiler.TestFile[]; - constructor(fileName: string, testCaseContent: Harness.TestCaseParser.TestCaseContent) { + constructor(fileName: string, testCaseContent?: Harness.TestCaseParser.TestCaseContent, configurationOverrides?: Harness.TestCaseParser.CompilerSettings) { this.fileName = fileName; this.justName = vpath.basename(fileName); + const rootDir = fileName.indexOf("conformance") === -1 ? "tests/cases/compiler/" : ts.getDirectoryPath(fileName) + "/"; + + if (testCaseContent === undefined) { + testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(Harness.IO.readFile(fileName), fileName, rootDir); + } + + if (configurationOverrides) { + testCaseContent = { ...testCaseContent, settings: { ...testCaseContent.settings, ...configurationOverrides } }; + } + const units = testCaseContent.testUnitData; this.harnessSettings = testCaseContent.settings; let tsConfigOptions: ts.CompilerOptions; @@ -174,32 +192,14 @@ class CompilerTest { this.options = this.result.options; } - public static getConfigurations(fileName: string) { - const content = Harness.IO.readFile(fileName); - const rootDir = fileName.indexOf("conformance") === -1 ? "tests/cases/compiler/" : ts.getDirectoryPath(fileName) + "/"; - const testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName, rootDir); - const configurations: CompilerTestConfiguration[] = []; - const scriptTargets = this._split(testCaseContent.settings.target); - const moduleKinds = this._split(testCaseContent.settings.module); - for (const scriptTarget of scriptTargets) { - for (const moduleKind of moduleKinds) { - let name = ""; - if (moduleKinds.length > 1) { - name += `@module: ${moduleKind || "none"}`; - } - if (scriptTargets.length > 1) { - if (name) name += ", "; - name += `@target: ${scriptTarget || "none"}`; - } - - const settings = { ...testCaseContent.settings }; - if (scriptTarget) settings.target = scriptTarget; - if (moduleKind) settings.module = moduleKind; - configurations.push({ name, payload: { ...testCaseContent, settings } }); - } - } - - return configurations; + public static getConfigurations(file: string): CompilerFileBasedTest { + // also see `parseCompilerTestConfigurations` in tests/webTestServer.ts + const content = Harness.IO.readFile(file); + const rootDir = file.indexOf("conformance") === -1 ? "tests/cases/compiler/" : ts.getDirectoryPath(file) + "/"; + const payload = Harness.TestCaseParser.makeUnitsFromTest(content, file, rootDir); + const settings = Harness.TestCaseParser.extractCompilerSettings(content); + const configurations = Harness.getFileBasedTestConfigurations(settings, /*varyBy*/ ["module", "target"]); + return { file, payload, configurations }; } public verifyDiagnostics() { @@ -267,11 +267,6 @@ class CompilerTest { this.toBeCompiled.concat(this.otherFiles).filter(file => !!this.result.program.getSourceFile(file.unitName))); } - private static _split(text: string) { - const entries = text && text.split(",").map(s => s.toLowerCase().trim()).filter(s => s.length > 0); - return entries && entries.length > 0 ? entries : [""]; - } - private makeUnitName(name: string, root: string) { const path = ts.toPath(name, root, ts.identity); const pathStart = ts.toPath(Harness.IO.getCurrentDirectory(), "", ts.identity); diff --git a/src/harness/externalCompileRunner.ts b/src/harness/externalCompileRunner.ts index 1d45351114d..1617a2d6734 100644 --- a/src/harness/externalCompileRunner.ts +++ b/src/harness/externalCompileRunner.ts @@ -28,7 +28,7 @@ abstract class ExternalCompileRunnerBase extends RunnerBase { describe(`${this.kind()} code samples`, () => { for (const test of testList) { - this.runTest(test); + this.runTest(typeof test === "string" ? test : test.file); } }); } @@ -91,14 +91,24 @@ class UserCodeRunner extends ExternalCompileRunnerBase { // tslint:disable-next-line:no-null-keyword return result.status === 0 && !result.stdout.length && !result.stderr.length ? null : `Exit Code: ${result.status} Standard output: -${result.stdout.toString().replace(/\r\n/g, "\n")} +${stripAbsoluteImportPaths(result.stdout.toString().replace(/\r\n/g, "\n"))} Standard error: -${result.stderr.toString().replace(/\r\n/g, "\n")}`; +${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`; } } +/** + * Import types and some other error messages use absolute paths in errors as they have no context to be written relative to; + * This is problematic for error baselines, so we grep for them and strip them out. + */ +function stripAbsoluteImportPaths(result: string) { + return result + .replace(/import\(".*?\/tests\/cases\/user\//g, `import("/`) + .replace(/Module '".*?\/tests\/cases\/user\//g, `Module '"/`); +} + class DefinitelyTypedRunner extends ExternalCompileRunnerBase { readonly testDir = "../DefinitelyTyped/types/"; workingDirectory = this.testDir; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 5e7dede93ee..9645e69c45c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -899,7 +899,7 @@ namespace FourSlash { } else { const found = actualByName.get(exclude.name); - if (found.source === exclude.source) { + if (found && found.source === exclude.source) { this.raiseError(`Did not expect to get a completion named ${exclude.name} with source ${exclude.source}`); } } @@ -3005,9 +3005,7 @@ Actual: ${stringify(fullActual)}`); } public verifyApplicableRefactorAvailableAtMarker(negative: boolean, markerName: string) { - const marker = this.getMarkerByName(markerName); - const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, marker.position, ts.defaultPreferences); - const isAvailable = applicableRefactors && applicableRefactors.length > 0; + const isAvailable = this.getApplicableRefactors(this.getMarkerByName(markerName).position).length > 0; if (negative && isAvailable) { this.raiseError(`verifyApplicableRefactorAvailableAtMarker failed - expected no refactor at marker ${markerName} but found some.`); } @@ -3024,9 +3022,7 @@ Actual: ${stringify(fullActual)}`); } public verifyRefactorAvailable(negative: boolean, name: string, actionName?: string) { - const selection = this.getSelection(); - - let refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, selection, ts.defaultPreferences) || []; + let refactors = this.getApplicableRefactors(this.getSelection()); refactors = refactors.filter(r => r.name === name && (actionName === undefined || r.actions.some(a => a.name === actionName))); const isAvailable = refactors.length > 0; @@ -3046,10 +3042,7 @@ Actual: ${stringify(fullActual)}`); } public verifyRefactor({ name, actionName, refactors }: FourSlashInterface.VerifyRefactorOptions) { - const selection = this.getSelection(); - - const actualRefactors = (this.languageService.getApplicableRefactors(this.activeFile.fileName, selection, ts.defaultPreferences) || ts.emptyArray) - .filter(r => r.name === name && r.actions.some(a => a.name === actionName)); + const actualRefactors = this.getApplicableRefactors(this.getSelection()).filter(r => r.name === name && r.actions.some(a => a.name === actionName)); this.assertObjectsEqual(actualRefactors, refactors); } @@ -3059,8 +3052,7 @@ Actual: ${stringify(fullActual)}`); throw new Error("Exactly one refactor range is allowed per test."); } - const applicableRefactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, ts.first(ranges), ts.defaultPreferences); - const isAvailable = applicableRefactors && applicableRefactors.length > 0; + const isAvailable = this.getApplicableRefactors(ts.first(ranges)).length > 0; if (negative && isAvailable) { this.raiseError(`verifyApplicableRefactorAvailableForRange failed - expected no refactor but found some.`); } @@ -3071,7 +3063,7 @@ Actual: ${stringify(fullActual)}`); public applyRefactor({ refactorName, actionName, actionDescription, newContent: newContentWithRenameMarker }: FourSlashInterface.ApplyRefactorOptions) { const range = this.getSelection(); - const refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, range, ts.defaultPreferences); + const refactors = this.getApplicableRefactors(range); const refactorsWithName = refactors.filter(r => r.name === refactorName); if (refactorsWithName.length === 0) { this.raiseError(`The expected refactor: ${refactorName} is not available at the marker location.\nAvailable refactors: ${refactors.map(r => r.name)}`); @@ -3117,7 +3109,48 @@ Actual: ${stringify(fullActual)}`); return { renamePosition, newContent }; } } + } + public noMoveToNewFile() { + for (const range of this.getRanges()) { + for (const refactor of this.getApplicableRefactors(range, { allowTextChangesInNewFiles: true })) { + if (refactor.name === "Move to a new file") { + ts.Debug.fail("Did not expect to get 'move to a new file' refactor"); + } + } + } + } + + public moveToNewFile(options: FourSlashInterface.MoveToNewFileOptions): void { + assert(this.getRanges().length === 1); + const range = this.getRanges()[0]; + const refactor = ts.find(this.getApplicableRefactors(range, { allowTextChangesInNewFiles: true }), r => r.name === "Move to a new file"); + assert(refactor.actions.length === 1); + const action = ts.first(refactor.actions); + assert(action.name === "Move to a new file" && action.description === "Move to a new file"); + + const editInfo = this.languageService.getEditsForRefactor(this.activeFile.fileName, this.formatCodeSettings, range, refactor.name, action.name, ts.defaultPreferences); + for (const edit of editInfo.edits) { + const newContent = options.newFileContents[edit.fileName]; + if (newContent === undefined) { + this.raiseError(`There was an edit in ${edit.fileName} but new content was not specified.`); + } + if (this.testData.files.some(f => f.fileName === edit.fileName)) { + this.applyEdits(edit.fileName, edit.textChanges, /*isFormattingEdit*/ false); + this.openFile(edit.fileName); + this.verifyCurrentFileContent(newContent); + } + else { + assert(edit.textChanges.length === 1); + const change = ts.first(edit.textChanges); + assert.deepEqual(change.span, ts.createTextSpan(0, 0)); + assert.equal(change.newText, newContent, `Content for ${edit.fileName}`); + } + } + + for (const fileName in options.newFileContents) { + assert(editInfo.edits.some(e => e.fileName === fileName)); + } } public verifyFileAfterApplyingRefactorAtMarker( @@ -3333,6 +3366,10 @@ Actual: ${stringify(fullActual)}`); this.verifyCurrentFileContent(options.newFileContents[fileName]); } } + + private getApplicableRefactors(positionOrRange: number | ts.TextRange, preferences = ts.defaultPreferences): ReadonlyArray { + return this.languageService.getApplicableRefactors(this.activeFile.fileName, positionOrRange, preferences) || ts.emptyArray; + } } export function runFourSlashTest(basePath: string, testType: FourSlashTestType, fileName: string) { @@ -4430,6 +4467,13 @@ namespace FourSlashInterface { public getEditsForFileRename(options: GetEditsForFileRenameOptions) { this.state.getEditsForFileRename(options); } + + public moveToNewFile(options: MoveToNewFileOptions): void { + this.state.moveToNewFile(options); + } + public noMoveToNewFile(): void { + this.state.noMoveToNewFile(); + } } export class Edit { @@ -4803,4 +4847,8 @@ namespace FourSlashInterface { readonly newPath: string; readonly newFileContents: { readonly [fileName: string]: string }; } + + export interface MoveToNewFileOptions { + readonly newFileContents: { readonly [fileName: string]: string }; + } } diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index d835054a868..d0ad139205a 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -36,6 +36,7 @@ class FourSlashRunner extends RunnerBase { } public enumerateTestFiles() { + // see also: `enumerateTestFiles` in tests/webTestServer.ts return this.enumerateFiles(this.basePath, /\.ts/i, { recursive: false }); } @@ -45,22 +46,23 @@ class FourSlashRunner extends RunnerBase { public initializeTests() { if (this.tests.length === 0) { - this.tests = this.enumerateTestFiles(); + this.tests = Harness.IO.enumerateTestFiles(this); } describe(this.testSuiteName + " tests", () => { - this.tests.forEach((fn: string) => { - describe(fn, () => { - fn = ts.normalizeSlashes(fn); - const justName = fn.replace(/^.*[\\\/]/, ""); + this.tests.forEach(test => { + const file = typeof test === "string" ? test : test.file; + describe(file, () => { + let fn = ts.normalizeSlashes(file); + const justName = fn.replace(/^.*[\\\/]/, ""); - // Convert to relative path - const testIndex = fn.indexOf("tests/"); - if (testIndex >= 0) fn = fn.substr(testIndex); + // Convert to relative path + const testIndex = fn.indexOf("tests/"); + if (testIndex >= 0) fn = fn.substr(testIndex); - if (justName && !justName.match(/fourslash\.ts$/i) && !justName.match(/\.d\.ts$/i)) { - it(this.testSuiteName + " test " + justName + " runs correctly", () => { - FourSlash.runFourSlashTest(this.basePath, this.testType, fn); + if (justName && !justName.match(/fourslash\.ts$/i) && !justName.match(/\.d\.ts$/i)) { + it(this.testSuiteName + " test " + justName + " runs correctly", () => { + FourSlash.runFourSlashTest(this.basePath, this.testType, fn); }); } }); diff --git a/src/harness/harness.ts b/src/harness/harness.ts index d73bfd2ed63..28233b797da 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -514,6 +514,7 @@ namespace Harness { fileExists(fileName: string): boolean; directoryExists(path: string): boolean; deleteFile(fileName: string): void; + enumerateTestFiles(runner: RunnerBase): (string | FileBasedTest)[]; listFiles(path: string, filter?: RegExp, options?: { recursive?: boolean }): string[]; log(text: string): void; args(): string[]; @@ -559,6 +560,10 @@ namespace Harness { return dirPath === path ? undefined : dirPath; } + function enumerateTestFiles(runner: RunnerBase) { + return runner.enumerateTestFiles(); + } + function listFiles(path: string, spec: RegExp, options?: { recursive?: boolean }) { options = options || {}; @@ -639,6 +644,7 @@ namespace Harness { directoryExists: path => ts.sys.directoryExists(path), deleteFile, listFiles, + enumerateTestFiles, log: s => console.log(s), args: () => ts.sys.args, getExecutingFilePath: () => ts.sys.getExecutingFilePath(), @@ -913,6 +919,11 @@ namespace Harness { return ts.getDirectoryPath(ts.normalizeSlashes(url.pathname || "/")); } + function enumerateTestFiles(runner: RunnerBase): (string | FileBasedTest)[] { + const response = send(HttpRequestMessage.post(new URL("/api/enumerateTestFiles", serverRoot), HttpContent.text(runner.kind()))); + return hasJsonContent(response) ? JSON.parse(response.content.content) : []; + } + function listFiles(dirname: string, spec?: RegExp, options?: { recursive?: boolean }): string[] { if (spec || (options && !options.recursive)) { let results = IO.listFiles(dirname); @@ -959,6 +970,7 @@ namespace Harness { directoryExists, deleteFile, listFiles: Utils.memoize(listFiles, (path, spec, options) => `${path}|${spec}|${options ? options.recursive === true : true}`), + enumerateTestFiles: Utils.memoize(enumerateTestFiles, runner => runner.kind()), log: s => console.log(s), args: () => [], getExecutingFilePath: () => "", @@ -1761,6 +1773,74 @@ namespace Harness { } } + export interface FileBasedTest { + file: string; + configurations?: FileBasedTestConfiguration[]; + } + + export interface FileBasedTestConfiguration { + [key: string]: string; + } + + function splitVaryBySettingValue(text: string): string[] | undefined { + if (!text) return undefined; + const entries = text.split(/,/).map(s => s.trim().toLowerCase()).filter(s => s.length > 0); + return entries && entries.length > 1 ? entries : undefined; + } + + function computeFileBasedTestConfigurationVariations(configurations: FileBasedTestConfiguration[], variationState: FileBasedTestConfiguration, varyByEntries: [string, string[]][], offset: number) { + if (offset >= varyByEntries.length) { + // make a copy of the current variation state + configurations.push({ ...variationState }); + return; + } + + const [varyBy, entries] = varyByEntries[offset]; + for (const entry of entries) { + // set or overwrite the variation, then compute the next variation + variationState[varyBy] = entry; + computeFileBasedTestConfigurationVariations(configurations, variationState, varyByEntries, offset + 1); + } + } + + /** + * Compute FileBasedTestConfiguration variations based on a supplied list of variable settings. + */ + export function getFileBasedTestConfigurations(settings: TestCaseParser.CompilerSettings, varyBy: string[]): FileBasedTestConfiguration[] | undefined { + let varyByEntries: [string, string[]][] | undefined; + for (const varyByKey of varyBy) { + if (ts.hasProperty(settings, varyByKey)) { + // we only consider variations when there are 2 or more variable entries. + const entries = splitVaryBySettingValue(settings[varyByKey]); + if (entries) { + if (!varyByEntries) varyByEntries = []; + varyByEntries.push([varyByKey, entries]); + } + } + } + + if (!varyByEntries) return undefined; + + const configurations: FileBasedTestConfiguration[] = []; + computeFileBasedTestConfigurationVariations(configurations, /*variationState*/ {}, varyByEntries, /*offset*/ 0); + return configurations; + } + + /** + * Compute a description for this configuration based on its entries + */ + export function getFileBasedTestConfigurationDescription(configuration: FileBasedTestConfiguration) { + let name = ""; + if (configuration) { + const keys = Object.keys(configuration).sort(); + for (const key of keys) { + if (name) name += ", "; + name += `@${key}: ${configuration[key]}`; + } + } + return name; + } + export namespace TestCaseParser { /** all the necessary information to set the right compiler settings */ export interface CompilerSettings { @@ -1779,7 +1859,7 @@ namespace Harness { // Regex for parsing options in the format "@Alpha: Value of any sort" const optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*([^\r\n]*)/gm; // multiple matches on multiple lines - function extractCompilerSettings(content: string): CompilerSettings { + export function extractCompilerSettings(content: string): CompilerSettings { const opts: CompilerSettings = {}; let match: RegExpExecArray; @@ -1800,9 +1880,7 @@ namespace Harness { } /** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */ - export function makeUnitsFromTest(code: string, fileName: string, rootDir?: string): TestCaseContent { - const settings = extractCompilerSettings(code); - + export function makeUnitsFromTest(code: string, fileName: string, rootDir?: string, settings = extractCompilerSettings(code)): TestCaseContent { // List of all the subfiles we've parsed out const testUnitData: TestUnitData[] = []; diff --git a/src/harness/parallel/host.ts b/src/harness/parallel/host.ts index 75712bc7d9b..6a8b21c9702 100644 --- a/src/harness/parallel/host.ts +++ b/src/harness/parallel/host.ts @@ -81,7 +81,8 @@ namespace Harness.Parallel.Host { const { statSync }: { statSync(path: string): { size: number }; } = require("fs"); const path: { join: (...args: string[]) => string } = require("path"); for (const runner of runners) { - for (const file of runner.enumerateTestFiles()) { + for (const test of runner.enumerateTestFiles()) { + const file = typeof test === "string" ? test : test.file; let size: number; if (!perfData) { try { @@ -126,6 +127,7 @@ namespace Harness.Parallel.Host { let passingFiles = 0; let failingFiles = 0; let errorResults: ErrorInfo[] = []; + let passingResults: { name: string[] }[] = []; let totalPassing = 0; const startTime = Date.now(); @@ -197,9 +199,11 @@ namespace Harness.Parallel.Host { totalPassing += data.payload.passing; if (data.payload.errors.length) { errorResults = errorResults.concat(data.payload.errors); + passingResults = passingResults.concat(data.payload.passes); failingFiles++; } else { + passingResults = passingResults.concat(data.payload.passes); passingFiles++; } newPerfData[hashName(data.payload.runner, data.payload.file)] = data.payload.duration; @@ -366,21 +370,55 @@ namespace Harness.Parallel.Host { IO.writeFile(perfdataFileName(configOption), JSON.stringify(newPerfData, null, 4)); // tslint:disable-line:no-null-keyword - process.exit(errorResults.length); + if (Utils.getExecutionEnvironment() !== Utils.ExecutionEnvironment.Browser && process.env.CI === "true") { + const xunitReport = new xunit({ on: ts.noop, once: ts.noop }, { reporterOptions: { output: "./TEST-results.xml" } }); + xunitReport.stats = reporter.stats; + xunitReport.failures = reporter.failures; + const rootAttrs: {[index: string]: any} = { + name: "Tests", + tests: stats.tests, + failures: stats.failures, + errors: stats.failures, + skipped: stats.tests - stats.failures - stats.passes, + timestamp: (new Date()).toUTCString(), + time: (stats.duration / 1000) || 0 + }; + xunitReport.write(`` + "\n"); + xunitReport.write(` `${k}="${escape("" + rootAttrs[k])}"`).join(" ")}>`); + [...failures, ...ts.map(passingResults, makeMochaTest)].forEach(t => { + xunitReport.test(t); + }); + xunitReport.write(""); + xunitReport.done(failures, (f: any[]) => { + process.exit(f.length); + }); + } + else { + process.exit(failures.length); + } + } - function makeMochaTest(test: ErrorInfo) { + function makeMochaTest(test: ErrorInfo | TestInfo) { return { + state: (test as ErrorInfo).error ? "failed" : "passed", + parent: { + fullTitle: () => { + return test.name.slice(0, test.name.length - 1).join(" "); + } + }, + title: test.name[test.name.length - 1], fullTitle: () => { return test.name.join(" "); }, titlePath: () => { return test.name; }, - err: { - message: test.error, - stack: test.stack - } + isPending: () => false, + err: (test as ErrorInfo).error ? { + message: (test as ErrorInfo).error, + stack: (test as ErrorInfo).stack + } : undefined }; } @@ -391,6 +429,7 @@ namespace Harness.Parallel.Host { let mocha: any; let base: any; + let xunit: any; let color: any; let cursor: any; let readline: any; @@ -433,6 +472,7 @@ namespace Harness.Parallel.Host { function initializeProgressBarsDependencies() { mocha = require("mocha"); base = mocha.reporters.Base; + xunit = mocha.reporters.xunit; color = base.color; cursor = base.cursor; readline = require("readline"); diff --git a/src/harness/parallel/shared.ts b/src/harness/parallel/shared.ts index 26b03ac6234..46904fac896 100644 --- a/src/harness/parallel/shared.ts +++ b/src/harness/parallel/shared.ts @@ -7,8 +7,9 @@ namespace Harness.Parallel { export type ParallelHostMessage = ParallelTestMessage | ParallelCloseMessage | ParallelBatchMessage; export type ParallelErrorMessage = { type: "error", payload: { error: string, stack: string, name?: string[] } } | never; - export type ErrorInfo = ParallelErrorMessage["payload"] & { name: string[] }; - export type ParallelResultMessage = { type: "result", payload: { passing: number, errors: ErrorInfo[], duration: number, runner: TestRunnerKind | "unittest", file: string } } | never; + export type TestInfo = { name: string[] } | never; + export type ErrorInfo = ParallelErrorMessage["payload"] & TestInfo; + export type ParallelResultMessage = { type: "result", payload: { passing: number, errors: ErrorInfo[], passes: TestInfo[], duration: number, runner: TestRunnerKind | "unittest", file: string } } | never; export type ParallelBatchProgressMessage = { type: "progress", payload: ParallelResultMessage["payload"] } | never; export type ParallelTimeoutChangeMessage = { type: "timeout", payload: { duration: number | "reset" } } | never; export type ParallelClientMessage = ParallelErrorMessage | ParallelResultMessage | ParallelBatchProgressMessage | ParallelTimeoutChangeMessage; diff --git a/src/harness/parallel/worker.ts b/src/harness/parallel/worker.ts index 4a0f297eee6..d9053364745 100644 --- a/src/harness/parallel/worker.ts +++ b/src/harness/parallel/worker.ts @@ -1,5 +1,6 @@ namespace Harness.Parallel.Worker { let errors: ErrorInfo[] = []; + let passes: TestInfo[] = []; let passing = 0; type MochaCallback = (this: Mocha.ISuiteCallbackContext, done: MochaDone) => void; @@ -9,12 +10,13 @@ namespace Harness.Parallel.Worker { function resetShimHarnessAndExecute(runner: RunnerBase) { errors = []; + passes = []; passing = 0; testList.length = 0; const start = +(new Date()); runner.initializeTests(); testList.forEach(({ name, callback, kind }) => executeCallback(name, callback, kind)); - return { errors, passing, duration: +(new Date()) - start }; + return { errors, passes, passing, duration: +(new Date()) - start }; } @@ -152,6 +154,7 @@ namespace Harness.Parallel.Worker { try { // TODO: If we ever start using async test completions, polyfill promise return handling callback.call(fakeContext); + passes.push({ name: [...namestack] }); } catch (error) { errors.push({ error: error.message, stack: error.stack, name: [...namestack] }); @@ -178,6 +181,7 @@ namespace Harness.Parallel.Worker { errors.push({ error: err.toString(), stack: "", name: [...namestack] }); } else { + passes.push({ name: [...namestack] }); passing++; } completed = true; @@ -294,11 +298,12 @@ namespace Harness.Parallel.Worker { } if (unitTests[name]) { errors = []; + passes = []; passing = 0; const start = +(new Date()); executeSuiteCallback(name, unitTests[name]); delete unitTests[name]; - return { file: name, runner: unittest, errors, passing, duration: +(new Date()) - start }; + return { file: name, runner: unittest, errors, passes, passing, duration: +(new Date()) - start }; } throw new Error(`Unit test with name "${name}" was asked to be run, but such a test does not exist!`); } diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 8c396ec44f1..08e92a73be2 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -51,7 +51,7 @@ namespace project { describe("projects tests", () => { const tests = this.tests.length === 0 ? this.enumerateTestFiles() : this.tests; for (const test of tests) { - this.runProjectTestCase(test); + this.runProjectTestCase(typeof test === "string" ? test : test.file); } }); } diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index 80532d30b6f..b29ebb7f920 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -1,13 +1,10 @@ -/// - - type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project" | "rwc" | "test262" | "user" | "dt"; type CompilerTestKind = "conformance" | "compiler"; type FourslashTestKind = "fourslash" | "fourslash-shims" | "fourslash-shims-pp" | "fourslash-server"; abstract class RunnerBase { // contains the tests to run - public tests: string[] = []; + public tests: (string | Harness.FileBasedTest)[] = []; /** Add a source file to the runner's list of tests that need to be initialized with initializeTests */ public addTest(fileName: string) { @@ -20,7 +17,7 @@ abstract class RunnerBase { abstract kind(): TestRunnerKind; - abstract enumerateTestFiles(): string[]; + abstract enumerateTestFiles(): (string | Harness.FileBasedTest)[]; /** The working directory where tests are found. Needed for batch testing where the input path will differ from the output path inside baselines */ public workingDirectory = ""; diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index cc1e5466115..ec620e6611b 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -126,7 +126,7 @@ namespace RWC { compilerResult = Harness.Compiler.compileFiles( inputFiles, otherFiles, - /* harnessOptions */ undefined, + { useCaseSensitiveFileNames: "" + (ioLog.useCaseSensitiveFileNames || false) }, opts.options, // Since each RWC json file specifies its current directory in its json file, we need // to pass this information in explicitly instead of acquiring it from the process. @@ -212,6 +212,7 @@ namespace RWC { class RWCRunner extends RunnerBase { public enumerateTestFiles() { + // see also: `enumerateTestFiles` in tests/webTestServer.ts return Harness.IO.getDirectories("internal/cases/rwc/"); } @@ -225,7 +226,7 @@ class RWCRunner extends RunnerBase { public initializeTests(): void { // Read in and evaluate the test list for (const test of this.tests && this.tests.length ? this.tests : this.enumerateTestFiles()) { - this.runTest(test); + this.runTest(typeof test === "string" ? test : test.file); } } diff --git a/src/harness/test262Runner.ts b/src/harness/test262Runner.ts index 08a42ed2ff7..7f83d9101bd 100644 --- a/src/harness/test262Runner.ts +++ b/src/harness/test262Runner.ts @@ -101,6 +101,7 @@ class Test262BaselineRunner extends RunnerBase { } public enumerateTestFiles() { + // see also: `enumerateTestFiles` in tests/webTestServer.ts return ts.map(this.enumerateFiles(Test262BaselineRunner.basePath, Test262BaselineRunner.testFileExtensionRegex, { recursive: true }), ts.normalizePath); } @@ -113,7 +114,7 @@ class Test262BaselineRunner extends RunnerBase { }); } else { - this.tests.forEach(test => this.runTest(test)); + this.tests.forEach(test => this.runTest(typeof test === "string" ? test : test.file)); } } } diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index fd1d66f394d..4a95cd44928 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -105,6 +105,7 @@ "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixUnreachableCode.ts", "../services/codefixes/fixJSDocTypes.ts", "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", @@ -112,10 +113,12 @@ "../services/codefixes/inferFromUsage.ts", "../services/codefixes/fixInvalidImportSyntax.ts", "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/moduleSpecifiers.ts", "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/refactors/moveToNewFile.ts", "../services/sourcemaps.ts", "../services/services.ts", "../services/breakpoints.ts", diff --git a/src/harness/unittests/organizeImports.ts b/src/harness/unittests/organizeImports.ts index ebd5a7925a2..d8f15ce66bd 100644 --- a/src/harness/unittests/organizeImports.ts +++ b/src/harness/unittests/organizeImports.ts @@ -23,6 +23,15 @@ namespace ts { `import x from "./lib";`); }); + it("Sort - case-insensitive", () => { + assertSortsBefore( + `import y from "a";`, + `import x from "Z";`); + assertSortsBefore( + `import y from "A";`, + `import x from "z";`); + }); + function assertSortsBefore(importString1: string, importString2: string) { const [{moduleSpecifier: moduleSpecifier1}, {moduleSpecifier: moduleSpecifier2}] = parseImports(importString1, importString2); assert.equal(OrganizeImports.compareModuleSpecifiers(moduleSpecifier1, moduleSpecifier2), Comparison.LessThan); @@ -42,6 +51,13 @@ namespace ts { assertListEqual(actualCoalescedImports, expectedCoalescedImports); }); + it("Sort specifiers - case-insensitive", () => { + const sortedImports = parseImports(`import { default as M, a as n, B, y, Z as O } from "lib";`); + const actualCoalescedImports = OrganizeImports.coalesceImports(sortedImports); + const expectedCoalescedImports = parseImports(`import { a as n, B, default as M, y, Z as O } from "lib";`); + assertListEqual(actualCoalescedImports, expectedCoalescedImports); + }); + it("Combine side-effect-only imports", () => { const sortedImports = parseImports( `import "lib";`, @@ -243,6 +259,15 @@ D(); import { F1, F2 } from "lib"; import * as NS from "lib"; import D from "lib"; +`, + }, + libFile); + + testOrganizeImports("Unused_Empty", + { + path: "/test.ts", + content: ` +import { } from "lib"; `, }, libFile); diff --git a/src/harness/unittests/paths.ts b/src/harness/unittests/paths.ts index 0cd90be0483..0b28bedc929 100644 --- a/src/harness/unittests/paths.ts +++ b/src/harness/unittests/paths.ts @@ -268,25 +268,25 @@ describe("core paths", () => { assert.strictEqual(ts.resolvePath("a", "b", "../c"), "a/c"); }); it("getPathRelativeTo", () => { - assert.strictEqual(ts.getRelativePath("/", "/", /*ignoreCase*/ false), ""); - assert.strictEqual(ts.getRelativePath("/a", "/a", /*ignoreCase*/ false), ""); - assert.strictEqual(ts.getRelativePath("/a/", "/a", /*ignoreCase*/ false), ""); - assert.strictEqual(ts.getRelativePath("/a", "/", /*ignoreCase*/ false), ".."); - assert.strictEqual(ts.getRelativePath("/a", "/b", /*ignoreCase*/ false), "../b"); - assert.strictEqual(ts.getRelativePath("/a/b", "/b", /*ignoreCase*/ false), "../../b"); - assert.strictEqual(ts.getRelativePath("/a/b/c", "/b", /*ignoreCase*/ false), "../../../b"); - assert.strictEqual(ts.getRelativePath("/a/b/c", "/b/c", /*ignoreCase*/ false), "../../../b/c"); - assert.strictEqual(ts.getRelativePath("/a/b/c", "/a/b", /*ignoreCase*/ false), ".."); - assert.strictEqual(ts.getRelativePath("c:", "d:", /*ignoreCase*/ false), "d:/"); - assert.strictEqual(ts.getRelativePath("file:///", "file:///", /*ignoreCase*/ false), ""); - assert.strictEqual(ts.getRelativePath("file:///a", "file:///a", /*ignoreCase*/ false), ""); - assert.strictEqual(ts.getRelativePath("file:///a/", "file:///a", /*ignoreCase*/ false), ""); - assert.strictEqual(ts.getRelativePath("file:///a", "file:///", /*ignoreCase*/ false), ".."); - assert.strictEqual(ts.getRelativePath("file:///a", "file:///b", /*ignoreCase*/ false), "../b"); - assert.strictEqual(ts.getRelativePath("file:///a/b", "file:///b", /*ignoreCase*/ false), "../../b"); - assert.strictEqual(ts.getRelativePath("file:///a/b/c", "file:///b", /*ignoreCase*/ false), "../../../b"); - assert.strictEqual(ts.getRelativePath("file:///a/b/c", "file:///b/c", /*ignoreCase*/ false), "../../../b/c"); - assert.strictEqual(ts.getRelativePath("file:///a/b/c", "file:///a/b", /*ignoreCase*/ false), ".."); - assert.strictEqual(ts.getRelativePath("file:///c:", "file:///d:", /*ignoreCase*/ false), "file:///d:/"); + assert.strictEqual(ts.getRelativePathFromDirectory("/", "/", /*ignoreCase*/ false), ""); + assert.strictEqual(ts.getRelativePathFromDirectory("/a", "/a", /*ignoreCase*/ false), ""); + assert.strictEqual(ts.getRelativePathFromDirectory("/a/", "/a", /*ignoreCase*/ false), ""); + assert.strictEqual(ts.getRelativePathFromDirectory("/a", "/", /*ignoreCase*/ false), ".."); + assert.strictEqual(ts.getRelativePathFromDirectory("/a", "/b", /*ignoreCase*/ false), "../b"); + assert.strictEqual(ts.getRelativePathFromDirectory("/a/b", "/b", /*ignoreCase*/ false), "../../b"); + assert.strictEqual(ts.getRelativePathFromDirectory("/a/b/c", "/b", /*ignoreCase*/ false), "../../../b"); + assert.strictEqual(ts.getRelativePathFromDirectory("/a/b/c", "/b/c", /*ignoreCase*/ false), "../../../b/c"); + assert.strictEqual(ts.getRelativePathFromDirectory("/a/b/c", "/a/b", /*ignoreCase*/ false), ".."); + assert.strictEqual(ts.getRelativePathFromDirectory("c:", "d:", /*ignoreCase*/ false), "d:/"); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///", "file:///", /*ignoreCase*/ false), ""); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a", "file:///a", /*ignoreCase*/ false), ""); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a/", "file:///a", /*ignoreCase*/ false), ""); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a", "file:///", /*ignoreCase*/ false), ".."); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a", "file:///b", /*ignoreCase*/ false), "../b"); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a/b", "file:///b", /*ignoreCase*/ false), "../../b"); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a/b/c", "file:///b", /*ignoreCase*/ false), "../../../b"); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a/b/c", "file:///b/c", /*ignoreCase*/ false), "../../../b/c"); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///a/b/c", "file:///a/b", /*ignoreCase*/ false), ".."); + assert.strictEqual(ts.getRelativePathFromDirectory("file:///c:", "file:///d:", /*ignoreCase*/ false), "file:///d:/"); }); }); \ No newline at end of file diff --git a/src/harness/unittests/transform.ts b/src/harness/unittests/transform.ts index 14b9ccdbfb8..2da998339b6 100644 --- a/src/harness/unittests/transform.ts +++ b/src/harness/unittests/transform.ts @@ -267,7 +267,7 @@ namespace ts { const fs = vfs.createFromFileSystem(Harness.IO, /*caseSensitive*/ true, { documents: [new documents.TextDocument("/.src/index.ts", text)] }); const host = new fakes.CompilerHost(fs, opts.compilerOptions); const program = createProgram(["/.src/index.ts"], opts.compilerOptions, host); - program.emit(program.getSourceFiles()[1], (p, s, bom) => host.writeFile(p, s, bom), /*cancellationToken*/ undefined, /*onlyDts*/ true, opts.transformers); + program.emit(program.getSourceFile("/.src/index.ts"), (p, s, bom) => host.writeFile(p, s, bom), /*cancellationToken*/ undefined, /*onlyDts*/ true, opts.transformers); return fs.readFileSync("/.src/index.d.ts").toString(); } }); diff --git a/src/harness/unittests/tsconfigParsing.ts b/src/harness/unittests/tsconfigParsing.ts index f1b4d526581..7a47481b88d 100644 --- a/src/harness/unittests/tsconfigParsing.ts +++ b/src/harness/unittests/tsconfigParsing.ts @@ -217,6 +217,29 @@ namespace ts { assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, allFiles); }); + it("exclude declarationDir unless overridden", () => { + const tsconfigWithoutExclude = + `{ + "compilerOptions": { + "declarationDir": "declarations" + } + }`; + const tsconfigWithExclude = + `{ + "compilerOptions": { + "declarationDir": "declarations" + }, + "exclude": [ "types" ] + }`; + + const rootDir = "/"; + const allFiles = ["/declarations/a.d.ts", "/a.ts"]; + const expectedFiles = ["/a.ts"]; + + assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles); + assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, allFiles); + }); + it("implicitly exclude common package folders", () => { assertParseFileList( `{}`, diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index f26170ef6ae..980a27446f7 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -164,7 +164,7 @@ namespace ts.projectSystem { } export function fileStats(nonZeroStats: Partial): server.FileStats { - return { ts: 0, tsx: 0, dts: 0, js: 0, jsx: 0, ...nonZeroStats }; + return { ts: 0, tsx: 0, dts: 0, js: 0, jsx: 0, deferred: 0, ...nonZeroStats }; } export class TestServerEventManager { diff --git a/src/harness/vpath.ts b/src/harness/vpath.ts index 31430b50e2b..e2024f890c4 100644 --- a/src/harness/vpath.ts +++ b/src/harness/vpath.ts @@ -18,7 +18,7 @@ namespace vpath { export import dirname = ts.getDirectoryPath; export import basename = ts.getBaseFileName; export import extname = ts.getAnyExtensionFromPath; - export import relative = ts.getRelativePath; + export import relative = ts.getRelativePathFromDirectory; export import beneath = ts.containsPath; export import changeExtension = ts.changeAnyExtension; export import isTypeScript = ts.hasTypeScriptFileExtension; diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index 0364ba3402a..1d9625bd88d 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1107,6 +1107,15 @@ + + + + + + + + + @@ -2043,6 +2052,15 @@ + + + + + + + + + @@ -2421,6 +2439,15 @@ + + + + + + + + + @@ -3054,15 +3081,6 @@ - - - - - - - - - @@ -3072,6 +3090,12 @@ + + + + + + @@ -3144,6 +3168,15 @@ + + + + + + + + + @@ -3699,6 +3732,15 @@ + + + + + + + + + @@ -4302,6 +4344,15 @@ + + + + + + + + + @@ -5598,6 +5649,15 @@ + + + + + + + + + @@ -5616,6 +5676,24 @@ + + + + + + + + + + + + + + + + + + @@ -6012,6 +6090,24 @@ + + + + + + + + + + + + + + + + + + @@ -6438,6 +6534,15 @@ + + + + + + + + + @@ -6450,6 +6555,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index 0772c6551d1..96c3dd0c2ef 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1107,6 +1107,15 @@ + + + + + + + + + @@ -2043,6 +2052,15 @@ + + + + + + + + + @@ -2421,6 +2439,15 @@ + + + + + + + + + @@ -3054,15 +3081,6 @@ - - - - - - - - - @@ -3072,6 +3090,12 @@ + + + + + + @@ -3144,6 +3168,15 @@ + + + + + + + + + @@ -3699,6 +3732,15 @@ + + + + + + + + + @@ -4305,6 +4347,9 @@ + + + @@ -5607,6 +5652,9 @@ + + + @@ -5628,6 +5676,24 @@ + + + + + + + + + + + + + + + + + + @@ -6024,6 +6090,24 @@ + + + + + + + + + + + + + + + + + + @@ -6450,6 +6534,15 @@ + + + + + + + + + @@ -6462,6 +6555,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1a0f4433a62..dcc9b3136f7 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1116,6 +1116,15 @@ + + + + + + + + + @@ -2052,6 +2061,15 @@ + + + + + + + + + @@ -2430,6 +2448,15 @@ + + + + + + + + + @@ -3063,15 +3090,6 @@ - - - - - - - - - @@ -3081,6 +3099,12 @@ + + + + + + @@ -3153,6 +3177,15 @@ + + + + + + + + + @@ -3708,6 +3741,15 @@ + + + + + + + + + @@ -4314,6 +4356,9 @@ + + + @@ -5241,6 +5286,12 @@ + + + + + + @@ -5616,6 +5667,9 @@ + + + @@ -5637,6 +5691,24 @@ + + + + + + + + + + + + + + + + + + @@ -6033,6 +6105,24 @@ + + + + + + + + + + + + + + + + + + @@ -6459,6 +6549,15 @@ + + + + + + + + + @@ -6471,6 +6570,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index b6d30cd95f8..636853315c0 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1116,6 +1116,15 @@ + + + + + + + + + @@ -2052,6 +2061,15 @@ + + + + + + + + + @@ -2430,6 +2448,15 @@ + + + + + + + + + @@ -3063,15 +3090,6 @@ - - - - - - - - - @@ -3081,6 +3099,12 @@ + + + + + + @@ -3153,6 +3177,15 @@ + + + + + + + + + @@ -3708,6 +3741,15 @@ + + + + + + + + + @@ -4314,6 +4356,9 @@ + + + @@ -5616,6 +5661,9 @@ + + + @@ -5637,6 +5685,24 @@ + + + + + + + + + + + + + + + + + + @@ -6033,6 +6099,24 @@ + + + + + + + + + + + + + + + + + + @@ -6459,6 +6543,15 @@ + + + + + + + + + @@ -6471,6 +6564,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 83c9542ac40..916f34d4e42 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1116,6 +1116,15 @@ + + + + + + + + + @@ -2052,6 +2061,15 @@ + + + + + + + + + @@ -2430,6 +2448,15 @@ + + + + + + + + + @@ -3063,15 +3090,6 @@ - - - - - - - - - @@ -3081,6 +3099,12 @@ + + + + + + @@ -3153,6 +3177,15 @@ + + + + + + + + + @@ -3708,6 +3741,15 @@ + + + + + + + + + @@ -4314,6 +4356,9 @@ + + + @@ -5241,6 +5286,12 @@ + + + + + + @@ -5616,6 +5667,9 @@ + + + @@ -5637,6 +5691,24 @@ + + + + + + + + + + + + + + + + + + @@ -6033,6 +6105,24 @@ + + + + + + + + + + + + + + + + + + @@ -6459,6 +6549,15 @@ + + + + + + + + + @@ -6471,6 +6570,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1a9638ca02d..1dc680c5cae 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1107,6 +1107,15 @@ + + + + + + + + + @@ -2043,6 +2052,15 @@ + + + + + + + + + @@ -2421,6 +2439,15 @@ + + + + + + + + + @@ -3144,6 +3171,15 @@ + + + + + + + + + @@ -3699,6 +3735,15 @@ + + + + + + + + + @@ -4305,6 +4350,9 @@ + + + @@ -5607,6 +5655,9 @@ + + + @@ -5628,6 +5679,24 @@ + + + + + + + + + + + + + + + + + + @@ -6024,6 +6093,24 @@ + + + + + + + + + + + + + + + + + + @@ -6450,6 +6537,15 @@ + + + + + + + + + @@ -6462,6 +6558,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 4b662f5b9c3..8bc1db5c5a9 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1107,6 +1107,15 @@ + + + + + + + + + @@ -2043,6 +2052,15 @@ + + + + + + + + + @@ -2421,6 +2439,15 @@ + + + + + + + + + @@ -3054,15 +3081,6 @@ - - - - - - - - - @@ -3072,6 +3090,12 @@ + + + + + + @@ -3144,6 +3168,15 @@ + + + + + + + + + @@ -3699,6 +3732,15 @@ + + + + + + + + + @@ -4305,6 +4347,9 @@ + + + @@ -5232,6 +5277,12 @@ + + + + + + @@ -5607,6 +5658,9 @@ + + + @@ -5628,6 +5682,24 @@ + + + + + + + + + + + + + + + + + + @@ -6024,6 +6096,24 @@ + + + + + + + + + + + + + + + + + + @@ -6450,6 +6540,15 @@ + + + + + + + + + @@ -6462,6 +6561,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index e159b01229e..ab3b344d5a0 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1110,6 +1110,9 @@ + + + @@ -2052,6 +2055,9 @@ + + + @@ -2436,6 +2442,9 @@ + + + @@ -3072,15 +3081,6 @@ - - - - - - - - - @@ -3090,6 +3090,12 @@ + + + + + + @@ -3165,6 +3171,9 @@ + + + @@ -3726,6 +3735,9 @@ + + + @@ -4335,6 +4347,9 @@ + + + @@ -5262,6 +5277,12 @@ + + + + + + @@ -5637,6 +5658,9 @@ + + + @@ -5661,12 +5685,18 @@ + + + + + + @@ -6069,12 +6099,18 @@ + + + + + + @@ -6507,6 +6543,9 @@ + + + @@ -6525,6 +6564,9 @@ + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 6f596916ae7..8492ff60000 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1097,6 +1097,15 @@ + + + + + + + + + @@ -2033,6 +2042,15 @@ + + + + + + + + + @@ -2411,6 +2429,15 @@ + + + + + + + + + @@ -3044,15 +3071,6 @@ - - - - - - - - - @@ -3062,6 +3080,12 @@ + + + + + + @@ -3134,6 +3158,15 @@ + + + + + + + + + @@ -3689,6 +3722,15 @@ + + + + + + + + + @@ -4295,6 +4337,9 @@ + + + @@ -5597,6 +5642,9 @@ + + + @@ -5618,6 +5666,24 @@ + + + + + + + + + + + + + + + + + + @@ -6011,6 +6077,24 @@ + + + + + + + + + + + + + + + + + + @@ -6437,6 +6521,15 @@ + + + + + + + + + @@ -6449,6 +6542,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index 5d69f25ad5d..aebef0476e8 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1097,6 +1097,15 @@ + + + + + + + + + @@ -2033,6 +2042,15 @@ + + + + + + + + + @@ -2411,6 +2429,15 @@ + + + + + + + + + @@ -3044,15 +3071,6 @@ - - - - - - - - - @@ -3062,6 +3080,12 @@ + + + + + + @@ -3134,6 +3158,15 @@ + + + + + + + + + @@ -3689,6 +3722,15 @@ + + + + + + + + + @@ -4295,6 +4337,9 @@ + + + @@ -5597,6 +5642,9 @@ + + + @@ -5618,6 +5666,24 @@ + + + + + + + + + + + + + + + + + + @@ -6011,6 +6077,24 @@ + + + + + + + + + + + + + + + + + + @@ -6437,6 +6521,15 @@ + + + + + + + + + @@ -6449,6 +6542,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index 055e897855c..37c5615f81a 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1106,6 +1106,15 @@ + + + + + + + + + @@ -2042,6 +2051,15 @@ + + + + + + + + + @@ -2420,6 +2438,15 @@ + + + + + + + + + @@ -3053,15 +3080,6 @@ - - - - - - - - - @@ -3071,6 +3089,12 @@ + + + + + + @@ -3143,6 +3167,15 @@ + + + + + + + + + @@ -3698,6 +3731,15 @@ + + + + + + + + + @@ -5231,6 +5273,12 @@ + + + + + + @@ -5606,6 +5654,9 @@ + + + @@ -5627,6 +5678,24 @@ + + + + + + + + + + + + + + + + + + @@ -6023,6 +6092,24 @@ + + + + + + + + + + + + + + + + + + @@ -6449,6 +6536,12 @@ + + + + + + @@ -6461,6 +6554,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 19679bd8c21..420331075cf 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1100,6 +1100,15 @@ + + + + + + + + + @@ -2036,6 +2045,15 @@ + + + + + + + + + @@ -2414,6 +2432,15 @@ + + + + + + + + + @@ -3047,15 +3074,6 @@ - - - - - - - - - @@ -3065,6 +3083,12 @@ + + + + + + @@ -3137,6 +3161,15 @@ + + + + + + + + + @@ -3692,6 +3725,15 @@ + + + + + + + + + @@ -4298,6 +4340,9 @@ + + + @@ -5600,6 +5645,9 @@ + + + @@ -5621,6 +5669,24 @@ + + + + + + + + + + + + + + + + + + @@ -6017,6 +6083,24 @@ + + + + + + + + + + + + + + + + + + @@ -6443,6 +6527,15 @@ + + + + + + + + + @@ -6455,6 +6548,15 @@ + + + + + + + + + diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 9de36f0687f..a5a4bceb43c 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -83,6 +83,7 @@ namespace ts.server { readonly ts: number; readonly tsx: number; readonly dts: number; + readonly deferred: number; } export interface OpenFileInfo { diff --git a/src/server/project.ts b/src/server/project.ts index a19739d2ba1..6073cd9caef 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -11,7 +11,7 @@ namespace ts.server { /* @internal */ export function countEachFileTypes(infos: ScriptInfo[]): FileStats { - const result: Mutable = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0 }; + const result: Mutable = { js: 0, jsx: 0, ts: 0, tsx: 0, dts: 0, deferred: 0 }; for (const info of infos) { switch (info.scriptKind) { case ScriptKind.JS: @@ -28,6 +28,9 @@ namespace ts.server { case ScriptKind.TSX: result.tsx += 1; break; + case ScriptKind.Deferred: + result.deferred += 1; + break; } } return result; diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 71ff00e6ac1..fee3a872370 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -101,6 +101,7 @@ "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixUnreachableCode.ts", "../services/codefixes/fixJSDocTypes.ts", "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", @@ -108,10 +109,12 @@ "../services/codefixes/inferFromUsage.ts", "../services/codefixes/fixInvalidImportSyntax.ts", "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/moduleSpecifiers.ts", "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/refactors/moveToNewFile.ts", "../services/sourcemaps.ts", "../services/services.ts", "../services/breakpoints.ts", diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index 95489ff0ea3..b87bf9b5e92 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -107,6 +107,7 @@ "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixUnreachableCode.ts", "../services/codefixes/fixJSDocTypes.ts", "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", @@ -114,10 +115,12 @@ "../services/codefixes/inferFromUsage.ts", "../services/codefixes/fixInvalidImportSyntax.ts", "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/moduleSpecifiers.ts", "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/refactors/moveToNewFile.ts", "../services/sourcemaps.ts", "../services/services.ts", "../services/breakpoints.ts", diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index faab2b08db6..6815be9863d 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -41,7 +41,7 @@ namespace ts.BreakpointResolver { } function textSpanEndingAtNextToken(startNode: Node, previousTokenToFindNextEndToken: Node): TextSpan { - return textSpan(startNode, findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent)); + return textSpan(startNode, findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent, sourceFile)); } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { @@ -60,7 +60,7 @@ namespace ts.BreakpointResolver { } function spanInNextNode(node: Node): TextSpan { - return spanInNode(findNextToken(node, node.parent)); + return spanInNode(findNextToken(node, node.parent, sourceFile)); } function spanInNode(node: Node): TextSpan { diff --git a/src/services/codefixes/convertToEs6Module.ts b/src/services/codefixes/convertToEs6Module.ts index b496697d541..57af2edcd01 100644 --- a/src/services/codefixes/convertToEs6Module.ts +++ b/src/services/codefixes/convertToEs6Module.ts @@ -487,15 +487,6 @@ namespace ts.codefix { : makeImport(/*name*/ undefined, [makeImportSpecifier(propertyName, localName)], moduleSpecifier); } - function makeImport(name: Identifier | undefined, namedImports: ReadonlyArray | undefined, moduleSpecifier: StringLiteralLike): ImportDeclaration { - return makeImportDeclaration(name, namedImports, moduleSpecifier); - } - - export function makeImportDeclaration(name: Identifier, namedImports: ReadonlyArray | undefined, moduleSpecifier: Expression) { - const importClause = (name || namedImports) && createImportClause(name, namedImports && createNamedImports(namedImports)); - return createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, importClause, moduleSpecifier); - } - function makeImportSpecifier(propertyName: string | undefined, name: string): ImportSpecifier { return createImportSpecifier(propertyName !== undefined && propertyName !== name ? createIdentifier(propertyName) : undefined, createIdentifier(name)); } diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index 50bf41360bc..89a9aca461c 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -28,7 +28,7 @@ namespace ts.codefix { const variations: CodeFixAction[] = []; // import Bluebird from "bluebird"; - variations.push(createAction(context, sourceFile, node, makeImportDeclaration(namespace.name, /*namedImports*/ undefined, node.moduleSpecifier))); + variations.push(createAction(context, sourceFile, node, makeImport(namespace.name, /*namedImports*/ undefined, node.moduleSpecifier))); if (getEmitModuleKind(opts) === ModuleKind.CommonJS) { // import Bluebird = require("bluebird"); diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts new file mode 100644 index 00000000000..5b075d6af1f --- /dev/null +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -0,0 +1,89 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "fixUnreachableCode"; + const errorCodes = [Diagnostics.Unreachable_code_detected.code]; + registerCodeFix({ + errorCodes, + getCodeActions(context) { + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start)); + return [createCodeFixAction(fixId, changes, Diagnostics.Remove_unreachable_code, fixId, Diagnostics.Remove_all_unreachable_code)]; + }, + fixIds: [fixId], + getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, diag.start)), + }); + + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, start: number): void { + const token = getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false); + const statement = findAncestor(token, isStatement); + Debug.assert(statement.getStart(sourceFile) === token.getStart(sourceFile)); + + const container = (isBlock(statement.parent) ? statement.parent : statement).parent; + switch (container.kind) { + case SyntaxKind.IfStatement: + if ((container as IfStatement).elseStatement) { + if (isBlock(statement.parent)) { + changes.deleteNodeRange(sourceFile, first(statement.parent.statements), last(statement.parent.statements)); + } + else { + changes.replaceNode(sourceFile, statement, createBlock(emptyArray)); + } + break; + } + // falls through + case SyntaxKind.WhileStatement: + case SyntaxKind.ForStatement: + changes.deleteNode(sourceFile, container); + break; + default: + if (isBlock(statement.parent)) { + split(sliceAfter(statement.parent.statements, statement), shouldRemove, (start, end) => changes.deleteNodeRange(sourceFile, start, end)); + } + else { + changes.deleteNode(sourceFile, statement); + } + } + } + + function shouldRemove(s: Statement): boolean { + // Don't remove statements that can validly be used before they appear. + return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && + // `var x;` may declare a variable used above + !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & (NodeFlags.Let | NodeFlags.Const)) && s.declarationList.declarations.some(d => !d.initializer)); + } + + function isPurelyTypeDeclaration(s: Statement): boolean { + switch (s.kind) { + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + return true; + case SyntaxKind.ModuleDeclaration: + return getModuleInstanceState(s as ModuleDeclaration) !== ModuleInstanceState.Instantiated; + case SyntaxKind.EnumDeclaration: + return hasModifier(s, ModifierFlags.Const); + } + } + + function sliceAfter(arr: ReadonlyArray, value: T): ReadonlyArray { + const index = arr.indexOf(value); + Debug.assert(index !== -1); + return arr.slice(index); + } + + // Calls 'cb' with the start and end of each range where 'pred' is true. + function split(arr: ReadonlyArray, pred: (t: T) => boolean, cb: (start: T, end: T) => void): void { + let start: T | undefined; + for (let i = 0; i < arr.length; i++) { + const value = arr[i]; + if (pred(value)) { + start = start || value; + } + else { + if (start) { + cb(start, arr[i - 1]); + start = undefined; + } + } + } + if (start) cb(start, arr[arr.length - 1]); + } +} diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 68b6e9a856f..d30e2a2cf60 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -101,7 +101,7 @@ namespace ts.codefix { const exportInfos = getAllReExportingModules(exportedSymbol, moduleSymbol, symbolName, sourceFile, 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 moduleSpecifier = first(getNewImportInfos(program, sourceFile, exportInfos, host, preferences)).moduleSpecifier; const ctx: ImportCodeFixContext = { host, program, checker, compilerOptions, sourceFile, formatContext, symbolName, getCanonicalFileName, symbolToken, preferences }; return { moduleSpecifier, codeAction: first(getCodeActionsForImport(exportInfos, ctx)) }; } @@ -225,10 +225,6 @@ namespace ts.codefix { } } - function usesJsExtensionOnImports(sourceFile: SourceFile): boolean { - return firstDefined(sourceFile.imports, ({ text }) => pathIsRelative(text) ? fileExtensionIs(text, Extension.Js) : undefined) || false; - } - function createImportClauseOfKind(kind: ImportKind.Default | ImportKind.Named | ImportKind.Namespace, symbolName: string) { const id = createIdentifier(symbolName); switch (kind) { @@ -247,320 +243,17 @@ namespace ts.codefix { program: Program, sourceFile: SourceFile, moduleSymbols: ReadonlyArray, - compilerOptions: CompilerOptions, - getCanonicalFileName: (file: string) => string, host: LanguageServiceHost, 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 => { - const sourceDirectory = getDirectoryPath(sourceFile.fileName); - const global = tryGetModuleNameFromAmbientModule(moduleSymbol) - || tryGetModuleNameFromTypeRoots(compilerOptions, host, getCanonicalFileName, moduleFileName, addJsExtension) - || tryGetModuleNameAsNodeModule(compilerOptions, moduleFileName, host, getCanonicalFileName, sourceDirectory) - || rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName); - if (global) { - return [global]; - } - - const relativePath = removeExtensionAndIndexPostFix(ensurePathIsNonModuleName(getRelativePath(sourceDirectory, moduleFileName, getCanonicalFileName)), moduleResolutionKind, addJsExtension); - if (!baseUrl || preferences.importModuleSpecifierPreference === "relative") { - return [relativePath]; - } - - const relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseUrl, getCanonicalFileName); - if (!relativeToBaseUrl) { - return [relativePath]; - } - - const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, moduleResolutionKind, addJsExtension); - if (paths) { - const fromPaths = tryGetModuleNameFromPaths(removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths); - if (fromPaths) { - return [fromPaths]; - } - } - - if (preferences.importModuleSpecifierPreference === "non-relative") { - return [importRelativeToBaseUrl]; - } - - if (preferences.importModuleSpecifierPreference !== undefined) Debug.assertNever(preferences.importModuleSpecifierPreference); - - if (isPathRelativeToParent(relativeToBaseUrl)) { - return [relativePath]; - } - - /* - Prefer a relative import over a baseUrl import if it doesn't traverse up to baseUrl. - - Suppose we have: - baseUrl = /base - sourceDirectory = /base/a/b - moduleFileName = /base/foo/bar - Then: - relativePath = ../../foo/bar - getRelativePathNParents(relativePath) = 2 - pathFromSourceToBaseUrl = ../../ - getRelativePathNParents(pathFromSourceToBaseUrl) = 2 - 2 < 2 = false - In this case we should prefer using the baseUrl path "/a/b" instead of the relative path "../../foo/bar". - - Suppose we have: - baseUrl = /base - sourceDirectory = /base/foo/a - moduleFileName = /base/foo/bar - Then: - relativePath = ../a - getRelativePathNParents(relativePath) = 1 - pathFromSourceToBaseUrl = ../../ - getRelativePathNParents(pathFromSourceToBaseUrl) = 2 - 1 < 2 = true - In this case we should prefer using the relative path "../a" instead of the baseUrl path "foo/a". - */ - const pathFromSourceToBaseUrl = ensurePathIsNonModuleName(getRelativePath(sourceDirectory, baseUrl, getCanonicalFileName)); - const relativeFirst = getRelativePathNParents(relativePath) < getRelativePathNParents(pathFromSourceToBaseUrl); - return relativeFirst ? [relativePath, importRelativeToBaseUrl] : [importRelativeToBaseUrl, relativePath]; - }); + const modulePathsGroups = moduleSpecifiers.getModuleSpecifiers(moduleSymbol, program, sourceFile, host, preferences); return modulePathsGroups.map(group => group.map(moduleSpecifier => ({ moduleSpecifier, importKind }))); }); // Sort to keep the shortest paths first, but keep [relativePath, importRelativeToBaseUrl] groups together return flatten(choicesForEachExportingModule.sort((a, b) => first(a).moduleSpecifier.length - first(b).moduleSpecifier.length)); } - /** - * Looks for a existing imports that use symlinks to this module. - * Only if no symlink is available, the real path will be used. - */ - function getAllModulePaths(program: Program, { fileName }: SourceFile): ReadonlyArray { - const symlinks = mapDefined(program.getSourceFiles(), sf => - sf.resolvedModules && firstDefinedIterator(sf.resolvedModules.values(), res => - res && res.resolvedFileName === fileName ? res.originalPath : undefined)); - return symlinks.length === 0 ? [fileName] : symlinks; - } - - function getRelativePathNParents(relativePath: string): number { - const components = getPathComponents(relativePath); - if (components[0] || components.length === 1) return 0; - for (let i = 1; i < components.length; i++) { - if (components[i] !== "..") return i - 1; - } - return components.length - 1; - } - - function tryGetModuleNameFromAmbientModule(moduleSymbol: Symbol): string | undefined { - const decl = moduleSymbol.valueDeclaration; - if (isModuleDeclaration(decl) && isStringLiteral(decl.name)) { - return decl.name.text; - } - } - - function tryGetModuleNameFromPaths(relativeToBaseUrlWithIndex: string, relativeToBaseUrl: string, paths: MapLike>): string | undefined { - for (const key in paths) { - for (const patternText of paths[key]) { - const pattern = removeFileExtension(normalizePath(patternText)); - const indexOfStar = pattern.indexOf("*"); - if (indexOfStar === 0 && pattern.length === 1) { - continue; - } - else if (indexOfStar !== -1) { - const prefix = pattern.substr(0, indexOfStar); - const suffix = pattern.substr(indexOfStar + 1); - if (relativeToBaseUrl.length >= prefix.length + suffix.length && - startsWith(relativeToBaseUrl, prefix) && - endsWith(relativeToBaseUrl, suffix)) { - const matchedStar = relativeToBaseUrl.substr(prefix.length, relativeToBaseUrl.length - suffix.length); - return key.replace("*", matchedStar); - } - } - else if (pattern === relativeToBaseUrl || pattern === relativeToBaseUrlWithIndex) { - return key; - } - } - } - } - - function tryGetModuleNameFromRootDirs(rootDirs: ReadonlyArray, moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string): string | undefined { - const normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { - return undefined; - } - - const normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - const relativePath = normalizedSourcePath !== undefined ? ensurePathIsNonModuleName(getRelativePath(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; - return removeFileExtension(relativePath); - } - - function tryGetModuleNameFromTypeRoots( - options: CompilerOptions, - host: GetEffectiveTypeRootsHost, - getCanonicalFileName: (file: string) => string, - moduleFileName: string, - addJsExtension: boolean, - ): string | undefined { - const roots = getEffectiveTypeRoots(options, host); - return firstDefined(roots, unNormalizedTypeRoot => { - const typeRoot = toPath(unNormalizedTypeRoot, /*basePath*/ undefined, getCanonicalFileName); - if (startsWith(moduleFileName, typeRoot)) { - // For a type definition, we can strip `/index` even with classic resolution. - return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), ModuleResolutionKind.NodeJs, addJsExtension); - } - }); - } - - function tryGetModuleNameAsNodeModule( - options: CompilerOptions, - moduleFileName: string, - host: LanguageServiceHost, - getCanonicalFileName: (file: string) => string, - sourceDirectory: string, - ): string | undefined { - if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs) { - // nothing to do here - return undefined; - } - - const parts = getNodeModulePathParts(moduleFileName); - - if (!parts) { - return undefined; - } - - // Simplify the full file path to something that can be resolved by Node. - - // If the module could be imported by a directory name, use that directory's name - let moduleSpecifier = getDirectoryOrExtensionlessFileName(moduleFileName); - // Get a path that's relative to node_modules or the importing file's path - moduleSpecifier = getNodeResolvablePath(moduleSpecifier); - // If the module was found in @types, get the actual Node package name - return getPackageNameFromAtTypesDirectory(moduleSpecifier); - - function getDirectoryOrExtensionlessFileName(path: string): string { - // If the file is the main module, it can be imported by the package name - const packageRootPath = path.substring(0, parts.packageRootIndex); - const packageJsonPath = combinePaths(packageRootPath, "package.json"); - if (host.fileExists(packageJsonPath)) { - const packageJsonContent = JSON.parse(host.readFile(packageJsonPath)); - if (packageJsonContent) { - const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main; - if (mainFileRelative) { - const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName); - if (mainExportFile === getCanonicalFileName(path)) { - return packageRootPath; - } - } - } - } - - // We still have a file name - remove the extension - const fullModulePathWithoutExtension = removeFileExtension(path); - - // If the file is /index, it can be imported by its directory name - if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index") { - return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex); - } - - return fullModulePathWithoutExtension; - } - - function getNodeResolvablePath(path: string): string { - const basePath = path.substring(0, parts.topLevelNodeModulesIndex); - if (sourceDirectory.indexOf(basePath) === 0) { - // if node_modules folder is in this folder or any of its parent folders, no need to keep it. - return path.substring(parts.topLevelPackageNameIndex + 1); - } - else { - return ensurePathIsNonModuleName(getRelativePath(sourceDirectory, path, getCanonicalFileName)); - } - } - } - - function getNodeModulePathParts(fullPath: string) { - // If fullPath can't be valid module file within node_modules, returns undefined. - // Example of expected pattern: /base/path/node_modules/[@scope/otherpackage/@otherscope/node_modules/]package/[subdirectory/]file.js - // Returns indices: ^ ^ ^ ^ - - let topLevelNodeModulesIndex = 0; - let topLevelPackageNameIndex = 0; - let packageRootIndex = 0; - let fileNameIndex = 0; - - const enum States { - BeforeNodeModules, - NodeModules, - Scope, - PackageContent - } - - let partStart = 0; - let partEnd = 0; - let state = States.BeforeNodeModules; - - while (partEnd >= 0) { - partStart = partEnd; - partEnd = fullPath.indexOf("/", partStart + 1); - switch (state) { - case States.BeforeNodeModules: - if (fullPath.indexOf("/node_modules/", partStart) === partStart) { - topLevelNodeModulesIndex = partStart; - topLevelPackageNameIndex = partEnd; - state = States.NodeModules; - } - break; - case States.NodeModules: - case States.Scope: - if (state === States.NodeModules && fullPath.charAt(partStart + 1) === "@") { - state = States.Scope; - } - else { - packageRootIndex = partEnd; - state = States.PackageContent; - } - break; - case States.PackageContent: - if (fullPath.indexOf("/node_modules/", partStart) === partStart) { - state = States.NodeModules; - } - else { - state = States.PackageContent; - } - break; - } - } - - fileNameIndex = partStart; - - return state > States.NodeModules ? { topLevelNodeModulesIndex, topLevelPackageNameIndex, packageRootIndex, fileNameIndex } : undefined; - } - - function getPathRelativeToRootDirs(path: string, rootDirs: ReadonlyArray, getCanonicalFileName: GetCanonicalFileName): string | undefined { - return firstDefined(rootDirs, rootDir => { - const relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); - return isPathRelativeToParent(relativePath) ? undefined : relativePath; - }); - } - - function removeExtensionAndIndexPostFix(fileName: string, moduleResolutionKind: ModuleResolutionKind, addJsExtension: boolean): string { - const noExtension = removeFileExtension(fileName); - return addJsExtension - ? noExtension + ".js" - : moduleResolutionKind === ModuleResolutionKind.NodeJs - ? removeSuffix(noExtension, "/index") - : noExtension; - } - - function getRelativePathIfInDirectory(path: string, directoryPath: string, getCanonicalFileName: GetCanonicalFileName): string | undefined { - const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); - return isRootedDiskPath(relativePath) ? undefined : relativePath; - } - - function isPathRelativeToParent(path: string): boolean { - return startsWith(path, ".."); - } - function getCodeActionsForAddImport( exportInfos: ReadonlyArray, ctx: ImportCodeFixContext, @@ -585,7 +278,7 @@ namespace ts.codefix { const existingDeclaration = firstDefined(existingImports, newImportInfoFromExistingSpecifier); const newImportInfos = existingDeclaration ? [existingDeclaration] - : getNewImportInfos(ctx.program, ctx.sourceFile, exportInfos, ctx.compilerOptions, ctx.getCanonicalFileName, ctx.host, ctx.preferences); + : getNewImportInfos(ctx.program, ctx.sourceFile, exportInfos, ctx.host, ctx.preferences); for (const info of newImportInfos) { addNew.push(getCodeActionForNewImport(ctx, info)); } diff --git a/src/services/codefixes/moduleSpecifiers.ts b/src/services/codefixes/moduleSpecifiers.ts new file mode 100644 index 00000000000..94b7846d8e6 --- /dev/null +++ b/src/services/codefixes/moduleSpecifiers.ts @@ -0,0 +1,322 @@ +// Used by importFixes to synthesize import module specifiers. +/* @internal */ +namespace ts.moduleSpecifiers { + // For each symlink/original for a module, returns a list of ways to import that file. + export function getModuleSpecifiers( + moduleSymbol: Symbol, + program: Program, + importingSourceFile: SourceFile, + host: LanguageServiceHost, + preferences: UserPreferences, + ): ReadonlyArray> { + const compilerOptions = program.getCompilerOptions(); + const { baseUrl, paths, rootDirs } = compilerOptions; + const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); + const addJsExtension = usesJsExtensionOnImports(importingSourceFile); + const getCanonicalFileName = hostGetCanonicalFileName(host); + const sourceDirectory = getDirectoryPath(importingSourceFile.fileName); + + return getAllModulePaths(program, moduleSymbol.valueDeclaration.getSourceFile()).map(moduleFileName => { + const global = tryGetModuleNameFromAmbientModule(moduleSymbol) + || tryGetModuleNameFromTypeRoots(compilerOptions, host, getCanonicalFileName, moduleFileName, addJsExtension) + || tryGetModuleNameAsNodeModule(compilerOptions, moduleFileName, host, getCanonicalFileName, sourceDirectory) + || rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName); + if (global) { + return [global]; + } + + const relativePath = removeExtensionAndIndexPostFix(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), moduleResolutionKind, addJsExtension); + if (!baseUrl || preferences.importModuleSpecifierPreference === "relative") { + return [relativePath]; + } + + const relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseUrl, getCanonicalFileName); + if (!relativeToBaseUrl) { + return [relativePath]; + } + + const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, moduleResolutionKind, addJsExtension); + if (paths) { + const fromPaths = tryGetModuleNameFromPaths(removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths); + if (fromPaths) { + return [fromPaths]; + } + } + + if (preferences.importModuleSpecifierPreference === "non-relative") { + return [importRelativeToBaseUrl]; + } + + if (preferences.importModuleSpecifierPreference !== undefined) Debug.assertNever(preferences.importModuleSpecifierPreference); + + if (isPathRelativeToParent(relativeToBaseUrl)) { + return [relativePath]; + } + + /* + Prefer a relative import over a baseUrl import if it doesn't traverse up to baseUrl. + + Suppose we have: + baseUrl = /base + sourceDirectory = /base/a/b + moduleFileName = /base/foo/bar + Then: + relativePath = ../../foo/bar + getRelativePathNParents(relativePath) = 2 + pathFromSourceToBaseUrl = ../../ + getRelativePathNParents(pathFromSourceToBaseUrl) = 2 + 2 < 2 = false + In this case we should prefer using the baseUrl path "/a/b" instead of the relative path "../../foo/bar". + + Suppose we have: + baseUrl = /base + sourceDirectory = /base/foo/a + moduleFileName = /base/foo/bar + Then: + relativePath = ../a + getRelativePathNParents(relativePath) = 1 + pathFromSourceToBaseUrl = ../../ + getRelativePathNParents(pathFromSourceToBaseUrl) = 2 + 1 < 2 = true + In this case we should prefer using the relative path "../a" instead of the baseUrl path "foo/a". + */ + const pathFromSourceToBaseUrl = ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, baseUrl, getCanonicalFileName)); + const relativeFirst = getRelativePathNParents(relativePath) < getRelativePathNParents(pathFromSourceToBaseUrl); + return relativeFirst ? [relativePath, importRelativeToBaseUrl] : [importRelativeToBaseUrl, relativePath]; + }); + } + + function usesJsExtensionOnImports({ imports }: SourceFile): boolean { + return firstDefined(imports, ({ text }) => pathIsRelative(text) ? fileExtensionIs(text, Extension.Js) : undefined) || false; + } + + /** + * Looks for a existing imports that use symlinks to this module. + * Only if no symlink is available, the real path will be used. + */ + function getAllModulePaths(program: Program, { fileName }: SourceFile): ReadonlyArray { + const symlinks = mapDefined(program.getSourceFiles(), sf => + sf.resolvedModules && firstDefinedIterator(sf.resolvedModules.values(), res => + res && res.resolvedFileName === fileName ? res.originalPath : undefined)); + return symlinks.length === 0 ? [fileName] : symlinks; + } + + function getRelativePathNParents(relativePath: string): number { + const components = getPathComponents(relativePath); + if (components[0] || components.length === 1) return 0; + for (let i = 1; i < components.length; i++) { + if (components[i] !== "..") return i - 1; + } + return components.length - 1; + } + + function tryGetModuleNameFromAmbientModule(moduleSymbol: Symbol): string | undefined { + const decl = moduleSymbol.valueDeclaration; + if (isModuleDeclaration(decl) && isStringLiteral(decl.name)) { + return decl.name.text; + } + } + + function tryGetModuleNameFromPaths(relativeToBaseUrlWithIndex: string, relativeToBaseUrl: string, paths: MapLike>): string | undefined { + for (const key in paths) { + for (const patternText of paths[key]) { + const pattern = removeFileExtension(normalizePath(patternText)); + const indexOfStar = pattern.indexOf("*"); + if (indexOfStar === 0 && pattern.length === 1) { + continue; + } + else if (indexOfStar !== -1) { + const prefix = pattern.substr(0, indexOfStar); + const suffix = pattern.substr(indexOfStar + 1); + if (relativeToBaseUrl.length >= prefix.length + suffix.length && + startsWith(relativeToBaseUrl, prefix) && + endsWith(relativeToBaseUrl, suffix)) { + const matchedStar = relativeToBaseUrl.substr(prefix.length, relativeToBaseUrl.length - suffix.length); + return key.replace("*", matchedStar); + } + } + else if (pattern === relativeToBaseUrl || pattern === relativeToBaseUrlWithIndex) { + return key; + } + } + } + } + + function tryGetModuleNameFromRootDirs(rootDirs: ReadonlyArray, moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string): string | undefined { + const normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPath === undefined) { + return undefined; + } + + const normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + const relativePath = normalizedSourcePath !== undefined ? ensurePathIsNonModuleName(getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; + return removeFileExtension(relativePath); + } + + function tryGetModuleNameFromTypeRoots( + options: CompilerOptions, + host: GetEffectiveTypeRootsHost, + getCanonicalFileName: (file: string) => string, + moduleFileName: string, + addJsExtension: boolean, + ): string | undefined { + const roots = getEffectiveTypeRoots(options, host); + return firstDefined(roots, unNormalizedTypeRoot => { + const typeRoot = toPath(unNormalizedTypeRoot, /*basePath*/ undefined, getCanonicalFileName); + if (startsWith(moduleFileName, typeRoot)) { + // For a type definition, we can strip `/index` even with classic resolution. + return removeExtensionAndIndexPostFix(moduleFileName.substring(typeRoot.length + 1), ModuleResolutionKind.NodeJs, addJsExtension); + } + }); + } + + function tryGetModuleNameAsNodeModule( + options: CompilerOptions, + moduleFileName: string, + host: LanguageServiceHost, + getCanonicalFileName: (file: string) => string, + sourceDirectory: string, + ): string | undefined { + if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs) { + // nothing to do here + return undefined; + } + + const parts = getNodeModulePathParts(moduleFileName); + + if (!parts) { + return undefined; + } + + // Simplify the full file path to something that can be resolved by Node. + + // If the module could be imported by a directory name, use that directory's name + let moduleSpecifier = getDirectoryOrExtensionlessFileName(moduleFileName); + // Get a path that's relative to node_modules or the importing file's path + moduleSpecifier = getNodeResolvablePath(moduleSpecifier); + // If the module was found in @types, get the actual Node package name + return getPackageNameFromAtTypesDirectory(moduleSpecifier); + + function getDirectoryOrExtensionlessFileName(path: string): string { + // If the file is the main module, it can be imported by the package name + const packageRootPath = path.substring(0, parts.packageRootIndex); + const packageJsonPath = combinePaths(packageRootPath, "package.json"); + if (host.fileExists(packageJsonPath)) { + const packageJsonContent = JSON.parse(host.readFile(packageJsonPath)); + if (packageJsonContent) { + const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main; + if (mainFileRelative) { + const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName); + if (mainExportFile === getCanonicalFileName(path)) { + return packageRootPath; + } + } + } + } + + // We still have a file name - remove the extension + const fullModulePathWithoutExtension = removeFileExtension(path); + + // If the file is /index, it can be imported by its directory name + if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index") { + return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex); + } + + return fullModulePathWithoutExtension; + } + + function getNodeResolvablePath(path: string): string { + const basePath = path.substring(0, parts.topLevelNodeModulesIndex); + if (sourceDirectory.indexOf(basePath) === 0) { + // if node_modules folder is in this folder or any of its parent folders, no need to keep it. + return path.substring(parts.topLevelPackageNameIndex + 1); + } + else { + return ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, path, getCanonicalFileName)); + } + } + } + + function getNodeModulePathParts(fullPath: string) { + // If fullPath can't be valid module file within node_modules, returns undefined. + // Example of expected pattern: /base/path/node_modules/[@scope/otherpackage/@otherscope/node_modules/]package/[subdirectory/]file.js + // Returns indices: ^ ^ ^ ^ + + let topLevelNodeModulesIndex = 0; + let topLevelPackageNameIndex = 0; + let packageRootIndex = 0; + let fileNameIndex = 0; + + const enum States { + BeforeNodeModules, + NodeModules, + Scope, + PackageContent + } + + let partStart = 0; + let partEnd = 0; + let state = States.BeforeNodeModules; + + while (partEnd >= 0) { + partStart = partEnd; + partEnd = fullPath.indexOf("/", partStart + 1); + switch (state) { + case States.BeforeNodeModules: + if (fullPath.indexOf("/node_modules/", partStart) === partStart) { + topLevelNodeModulesIndex = partStart; + topLevelPackageNameIndex = partEnd; + state = States.NodeModules; + } + break; + case States.NodeModules: + case States.Scope: + if (state === States.NodeModules && fullPath.charAt(partStart + 1) === "@") { + state = States.Scope; + } + else { + packageRootIndex = partEnd; + state = States.PackageContent; + } + break; + case States.PackageContent: + if (fullPath.indexOf("/node_modules/", partStart) === partStart) { + state = States.NodeModules; + } + else { + state = States.PackageContent; + } + break; + } + } + + fileNameIndex = partStart; + + return state > States.NodeModules ? { topLevelNodeModulesIndex, topLevelPackageNameIndex, packageRootIndex, fileNameIndex } : undefined; + } + + function getPathRelativeToRootDirs(path: string, rootDirs: ReadonlyArray, getCanonicalFileName: GetCanonicalFileName): string | undefined { + return firstDefined(rootDirs, rootDir => { + const relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); + return isPathRelativeToParent(relativePath) ? undefined : relativePath; + }); + } + + function removeExtensionAndIndexPostFix(fileName: string, moduleResolutionKind: ModuleResolutionKind, addJsExtension: boolean): string { + const noExtension = removeFileExtension(fileName); + return addJsExtension + ? noExtension + ".js" + : moduleResolutionKind === ModuleResolutionKind.NodeJs + ? removeSuffix(noExtension, "/index") + : noExtension; + } + + function getRelativePathIfInDirectory(path: string, directoryPath: string, getCanonicalFileName: GetCanonicalFileName): string | undefined { + const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); + return isRootedDiskPath(relativePath) ? undefined : relativePath; + } + + function isPathRelativeToParent(path: string): boolean { + return startsWith(path, ".."); + } +} diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts index 632cfc97e00..99fc145b563 100644 --- a/src/services/codefixes/useDefaultImport.ts +++ b/src/services/codefixes/useDefaultImport.ts @@ -37,6 +37,6 @@ namespace ts.codefix { } function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, info: Info): void { - changes.replaceNode(sourceFile, info.importNode, makeImportDeclaration(info.name, /*namedImports*/ undefined, info.moduleSpecifier)); + changes.replaceNode(sourceFile, info.importNode, makeImport(info.name, /*namedImports*/ undefined, info.moduleSpecifier)); } } diff --git a/src/services/completions.ts b/src/services/completions.ts index 4950d1370e1..d8b0bbc138d 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -972,12 +972,8 @@ namespace ts.Completions { } else if (isRightOfOpenTag) { const tagSymbols = Debug.assertEachDefined(typeChecker.getJsxIntrinsicTagNamesAt(location), "getJsxIntrinsicTagNames() should all be defined"); - if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(s => !!(s.flags & (SymbolFlags.Value | SymbolFlags.Alias)))); - } - else { - symbols = tagSymbols; - } + tryGetGlobalSymbols(); + symbols = tagSymbols.concat(symbols); completionKind = CompletionKind.MemberLike; } else if (isStartingCloseTag) { @@ -1298,7 +1294,7 @@ namespace ts.Completions { const exportedSymbols = typeChecker.getExportsOfModule(symbol); // If the exported symbols contains type, // symbol can be referenced at locations where type is allowed - return forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation); + return exportedSymbols.some(symbolCanBeReferencedAtTypeLocation); } } @@ -2211,7 +2207,6 @@ namespace ts.Completions { function isValidTrigger(sourceFile: SourceFile, triggerCharacter: CompletionsTriggerCharacter, contextToken: Node, position: number): boolean { switch (triggerCharacter) { case ".": - case "/": case "@": return true; case '"': @@ -2222,6 +2217,10 @@ namespace ts.Completions { case "<": // Opening JSX tag return contextToken.kind === SyntaxKind.LessThanToken && contextToken.parent.kind !== SyntaxKind.BinaryExpression; + case "/": + return isStringLiteralLike(contextToken) + ? !!tryGetImportFromModuleSpecifier(contextToken) + : contextToken.kind === SyntaxKind.SlashToken && isJsxClosingElement(contextToken.parent); default: return Debug.assertNever(triggerCharacter); } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index bedb657a66d..5f4d653ca3d 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -236,7 +236,7 @@ namespace ts.FindAllReferences.Core { 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, sourceFilesSet); + return reference && getReferencedSymbolsForModule(program, program.getTypeChecker().getMergedSymbol(reference.file.symbol), /*excludeImportTypeOfExportEquals*/ false, sourceFiles, sourceFilesSet); } if (!options.implementations) { @@ -247,7 +247,7 @@ namespace ts.FindAllReferences.Core { } const checker = program.getTypeChecker(); - const symbol = checker.getSymbolAtLocation(node); + let symbol = checker.getSymbolAtLocation(node); // Could not find a symbol e.g. unknown identifier if (!symbol) { @@ -255,37 +255,37 @@ namespace ts.FindAllReferences.Core { return !options.implementations && isStringLiteral(node) ? getReferencesForStringLiteral(node, sourceFiles, cancellationToken) : undefined; } - if (symbol.flags & SymbolFlags.Module && isModuleReferenceLocation(node)) { - return getReferencedSymbolsForModule(program, symbol, sourceFiles, sourceFilesSet); + let moduleReferences: SymbolAndEntries[] = emptyArray; + const moduleSourceFile = isModuleSymbol(symbol); + if (moduleSourceFile) { + const exportEquals = symbol.exports.get(InternalSymbolName.ExportEquals); + // If !!exportEquals, we're about to add references to `import("mod")` anyway, so don't double-count them. + moduleReferences = getReferencedSymbolsForModule(program, symbol, !!exportEquals, sourceFiles, sourceFilesSet); + if (!exportEquals || !sourceFilesSet.has(moduleSourceFile.fileName)) return moduleReferences; + // Continue to get references to 'export ='. + symbol = skipAlias(exportEquals, checker); + node = undefined; } - - return getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options); + return concatenate(moduleReferences, getReferencedSymbolsForSymbol(symbol, node, sourceFiles, sourceFilesSet, checker, cancellationToken, options)); } - function isModuleReferenceLocation(node: Node): boolean { - if (!isStringLiteralLike(node)) { - return false; - } - switch (node.parent.kind) { - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ExternalModuleReference: - case SyntaxKind.ImportDeclaration: - case SyntaxKind.ExportDeclaration: - return true; - case SyntaxKind.LiteralType: - return isImportTypeNode(node.parent.parent); - case SyntaxKind.CallExpression: - return isRequireCall(node.parent as CallExpression, /*checkArgumentIsStringLiteralLike*/ false) || isImportCall(node.parent as CallExpression); - default: - return false; - } + function isModuleSymbol(symbol: Symbol): SourceFile | undefined { + return symbol.flags & SymbolFlags.Module && find(symbol.declarations, isSourceFile); } - function getReferencedSymbolsForModule(program: Program, symbol: Symbol, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap): SymbolAndEntries[] { + function getReferencedSymbolsForModule(program: Program, symbol: Symbol, excludeImportTypeOfExportEquals: boolean, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap): SymbolAndEntries[] { Debug.assert(!!symbol.valueDeclaration); - const references = findModuleReferences(program, sourceFiles, symbol).map(reference => { + const references = mapDefined(findModuleReferences(program, sourceFiles, symbol), reference => { if (reference.kind === "import") { + const parent = reference.literal.parent; + if (isLiteralTypeNode(parent)) { + const importType = cast(parent.parent, isImportTypeNode); + if (excludeImportTypeOfExportEquals && !importType.qualifier) { + return undefined; + } + } + // import("foo") with no qualifier will reference the `export =` of the module, which may be referenced anyway. return { type: "node", node: reference.literal }; } else { @@ -308,11 +308,12 @@ namespace ts.FindAllReferences.Core { } break; default: + // This may be merged with something. Debug.fail("Expected a module symbol to be declared by a SourceFile or ModuleDeclaration."); } } - return [{ definition: { type: "symbol", symbol }, references }]; + return references.length ? [{ definition: { type: "symbol", symbol }, references }] : emptyArray; } /** getReferencedSymbols for special node kinds. */ @@ -345,21 +346,21 @@ namespace ts.FindAllReferences.Core { } /** Core find-all-references algorithm for a normal symbol. */ - function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] { - symbol = skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) || symbol; + function getReferencedSymbolsForSymbol(symbol: Symbol, node: Node | undefined, sourceFiles: ReadonlyArray, sourceFilesSet: ReadonlyMap, checker: TypeChecker, cancellationToken: CancellationToken, options: Options): SymbolAndEntries[] { + symbol = node && skipPastExportOrImportSpecifierOrUnion(symbol, node, checker) || symbol; // Compute the meaning from the location and the symbol it references - const searchMeaning = getIntersectingMeaningFromDeclarations(node, symbol); + const searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All; const result: SymbolAndEntries[] = []; - const state = new State(sourceFiles, sourceFilesSet, getSpecialSearchKind(node), checker, cancellationToken, searchMeaning, options, result); + const state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : SpecialSearchKind.None, checker, cancellationToken, searchMeaning, options, result); - if (node.kind === SyntaxKind.DefaultKeyword) { + if (node && node.kind === SyntaxKind.DefaultKeyword) { addReference(node, symbol, state); searchForImportsOfExport(node, symbol, { exportingModuleSymbol: Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: ExportKind.Default }, state); } else { - const search = state.createSearch(node, symbol, /*comingFrom*/ undefined, { allSearchSymbols: populateSearchSymbolSet(symbol, node, checker, options.implementations) }); + const search = state.createSearch(node, symbol, /*comingFrom*/ undefined, { allSearchSymbols: node ? populateSearchSymbolSet(symbol, node, checker, options.implementations) : [symbol] }); // Try to get the smallest valid scope that we can limit our search to; // otherwise we'll need to search globally (i.e. include each file). @@ -499,7 +500,7 @@ namespace ts.FindAllReferences.Core { } /** @param allSearchSymbols set of additinal symbols for use by `includes`. */ - createSearch(location: Node, symbol: Symbol, comingFrom: ImportExport | undefined, searchOptions: { text?: string, allSearchSymbols?: Symbol[] } = {}): Search { + createSearch(location: Node | undefined, symbol: Symbol, comingFrom: ImportExport | undefined, searchOptions: { text?: string, allSearchSymbols?: Symbol[] } = {}): Search { // Note: if this is an external module symbol, the name doesn't include quotes. // Note: getLocalSymbolForExportDefault handles `export default class C {}`, but not `export default C` or `export { C as default }`. // The other two forms seem to be handled downstream (e.g. in `skipPastExportOrImportSpecifier`), so special-casing the first form @@ -509,7 +510,7 @@ namespace ts.FindAllReferences.Core { allSearchSymbols = [symbol], } = searchOptions; const escapedText = escapeLeadingUnderscores(text); - const parents = this.options.implementations && getParentSymbolsOfPropertyAccess(location, symbol, this.checker); + const parents = this.options.implementations && location && getParentSymbolsOfPropertyAccess(location, symbol, this.checker); return { symbol, comingFrom, text, escapedText, parents, allSearchSymbols, includes: sym => contains(allSearchSymbols, sym) }; } @@ -559,11 +560,7 @@ namespace ts.FindAllReferences.Core { if (singleReferences.length) { const addRef = state.referenceAdder(exportSymbol); for (const singleRef of singleReferences) { - // At `default` in `import { default as x }` or `export { default as x }`, do add a reference, but do not rename. - if (hasMatchingMeaning(singleRef, state) && - !(state.options.isForRename && (isExportSpecifier(singleRef.parent) || isImportSpecifier(singleRef.parent)) && singleRef.escapedText === InternalSymbolName.Default)) { - addRef(singleRef); - } + if (shouldAddSingleReference(singleRef, state)) addRef(singleRef); } } @@ -593,6 +590,15 @@ namespace ts.FindAllReferences.Core { } } + function shouldAddSingleReference(singleRef: Identifier | StringLiteral, state: State): boolean { + if (!hasMatchingMeaning(singleRef, state)) return false; + if (!state.options.isForRename) return true; + // Don't rename an import type `import("./module-name")` when renaming `name` in `export = name;` + if (!isIdentifier(singleRef)) return false; + // At `default` in `import { default as x }` or `export { default as x }`, do add a reference, but do not rename. + return !((isExportSpecifier(singleRef.parent) || isImportSpecifier(singleRef.parent)) && singleRef.escapedText === InternalSymbolName.Default); + } + // Go to the symbol we imported from and find references for it. function searchForImportedSymbol(symbol: Symbol, state: State): void { for (const declaration of symbol.declarations) { @@ -614,27 +620,19 @@ namespace ts.FindAllReferences.Core { checker.getPropertySymbolOfDestructuringAssignment(location); } - function getObjectBindingElementWithoutPropertyName(symbol: Symbol): BindingElement | undefined { + function getObjectBindingElementWithoutPropertyName(symbol: Symbol): BindingElement & { name: Identifier } | undefined { const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); if (bindingElement && bindingElement.parent.kind === SyntaxKind.ObjectBindingPattern && + isIdentifier(bindingElement.name) && !bindingElement.propertyName) { - return bindingElement; + return bindingElement as BindingElement & { name: Identifier }; } } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol: Symbol, checker: TypeChecker): Symbol | undefined { const bindingElement = getObjectBindingElementWithoutPropertyName(symbol); - if (!bindingElement) return undefined; - - const typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); - const propSymbol = typeOfPattern && checker.getPropertyOfType(typeOfPattern, (bindingElement.name).text); - if (propSymbol && propSymbol.flags & SymbolFlags.Accessor) { - // See GH#16922 - Debug.assert(!!(propSymbol.flags & SymbolFlags.Transient)); - return (propSymbol as TransientSymbol).target; - } - return propSymbol; + return bindingElement && getPropertySymbolFromBindingElement(checker, bindingElement); } /** diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 0e89be42532..a75781b8da0 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -269,7 +269,7 @@ namespace ts.formatting { } function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken: Node, current: Node, lineAtPosition: number, sourceFile: SourceFile): NextTokenKind { - const nextToken = findNextToken(precedingToken, current); + const nextToken = findNextToken(precedingToken, current, sourceFile); if (!nextToken) { return NextTokenKind.Unknown; } diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index d5fc94c6d62..f8bcf02d036 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -55,7 +55,7 @@ namespace ts { function getPathUpdater(oldFilePath: string, newFilePath: string, host: LanguageServiceHost): (oldPath: string) => string | undefined { // Get the relative path from old to new location, and append it on to the end of imports and normalize. - const rel = ensurePathIsNonModuleName(getRelativePath(getDirectoryPath(oldFilePath), newFilePath, createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host)))); + const rel = getRelativePathFromFile(oldFilePath, newFilePath, createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host))); return oldPath => { if (!pathIsRelative(oldPath)) return; return ensurePathIsNonModuleName(normalizePath(combinePaths(getDirectoryPath(oldPath), rel))); diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index 4858fdc4b34..4f9836dfdf6 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -3,9 +3,9 @@ namespace ts.FindAllReferences { export interface ImportsResult { /** For every import of the symbol, the location and local symbol for the import. */ - importSearches: [Identifier, Symbol][]; + importSearches: ReadonlyArray<[Identifier, Symbol]>; /** For rename imports/exports `{ foo as bar }`, `foo` is not a local, so it may be added as a reference immediately without further searching. */ - singleReferences: Identifier[]; + singleReferences: ReadonlyArray; /** List of source files that may (or may not) use the symbol via a namespace. (For UMD modules this is every file.) */ indirectUsers: ReadonlyArray; } @@ -33,7 +33,7 @@ namespace ts.FindAllReferences { interface AmbientModuleDeclaration extends ModuleDeclaration { body?: ModuleBlock; } type SourceFileLike = SourceFile | AmbientModuleDeclaration; // Identifier for the case of `const x = require("y")`. - type Importer = AnyImportOrReExport | ImportTypeNode | Identifier; + type Importer = AnyImportOrReExport | ValidImportTypeNode | Identifier; type ImporterOrCallExpression = Importer | CallExpression; /** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */ @@ -135,13 +135,7 @@ namespace ts.FindAllReferences { break; case SyntaxKind.ImportType: - if (direct.qualifier) { - // `import("foo").x` named import - directImports.push(direct); - } - else { - // TODO: GH#23879 - } + directImports.push(direct); break; default: @@ -205,7 +199,7 @@ namespace ts.FindAllReferences { */ function getSearchesFromDirectImports(directImports: Importer[], exportSymbol: Symbol, exportKind: ExportKind, checker: TypeChecker, isForRename: boolean): Pick { const importSearches: [Identifier, Symbol][] = []; - const singleReferences: Identifier[] = []; + const singleReferences: (Identifier | StringLiteral)[] = []; function addSearch(location: Identifier, symbol: Symbol): void { importSearches.push([location, symbol]); } @@ -232,8 +226,13 @@ namespace ts.FindAllReferences { } if (decl.kind === SyntaxKind.ImportType) { - if (decl.qualifier) { // TODO: GH#23879 - singleReferences.push(decl.qualifier.kind === SyntaxKind.Identifier ? decl.qualifier : decl.qualifier.right); + if (decl.qualifier) { + if (isIdentifier(decl.qualifier) && decl.qualifier.escapedText === symbolName(exportSymbol)) { + singleReferences.push(decl.qualifier); + } + } + else if (exportKind === ExportKind.ExportEquals) { + singleReferences.push(decl.argument.literal); } return; } @@ -267,7 +266,7 @@ namespace ts.FindAllReferences { const { name } = importClause; // If a default import has the same name as the default export, allow to rename it. // Given `import f` and `export default function f`, we will rename both, but for `import g` we will rename just that. - if (name && (!isForRename || name.escapedText === symbolName(exportSymbol))) { + if (name && (!isForRename || name.escapedText === symbolEscapedNameNoDefault(exportSymbol))) { const defaultImportAlias = checker.getSymbolAtLocation(name); addSearch(name, defaultImportAlias); } @@ -550,7 +549,7 @@ namespace ts.FindAllReferences { // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. // (All imports returned from this function will be ignored anyway if we are in rename and this is a not a named export.) - const importedName = symbolName(importedSymbol); + const importedName = symbolEscapedNameNoDefault(importedSymbol); if (importedName === undefined || importedName === InternalSymbolName.Default || importedName === symbol.escapedName) { return { kind: ImportExport.Import, symbol: importedSymbol, ...isImport }; } @@ -622,17 +621,6 @@ namespace ts.FindAllReferences { return isExternalModuleSymbol(exportingModuleSymbol) ? { exportingModuleSymbol, exportKind } : undefined; } - function symbolName(symbol: Symbol): __String | undefined { - if (symbol.escapedName !== InternalSymbolName.Default) { - return symbol.escapedName; - } - - return forEach(symbol.declarations, decl => { - const name = getNameOfDeclaration(decl); - return name && name.kind === SyntaxKind.Identifier && name.escapedText; - }); - } - /** If at an export specifier, go to the symbol it refers to. */ function skipExportSpecifierSymbol(symbol: Symbol, checker: TypeChecker): Symbol { // For `export { foo } from './bar", there's nothing to skip, because it does not create a new alias. But `export { foo } does. diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 5109b050b6b..fa30b5cd30e 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -198,7 +198,9 @@ namespace ts.OrganizeImports { : namedImports[0]; const newNamedImports = sortedImportSpecifiers.length === 0 - ? undefined + ? newDefaultImport + ? undefined + : createNamedImports(emptyArray) : namedImports.length === 0 ? createNamedImports(sortedImportSpecifiers) : updateNamedImports(namedImports[0].importClause.namedBindings as NamedImports, sortedImportSpecifiers); @@ -254,7 +256,7 @@ namespace ts.OrganizeImports { } function compareIdentifiers(s1: Identifier, s2: Identifier) { - return compareStringsCaseSensitive(s1.text, s2.text); + return compareStringsCaseInsensitive(s1.text, s2.text); } } @@ -277,6 +279,6 @@ namespace ts.OrganizeImports { const name2 = getExternalModuleName(m2); return compareBooleans(name1 === undefined, name2 === undefined) || compareBooleans(isExternalModuleNameRelative(name1), isExternalModuleNameRelative(name2)) || - compareStringsCaseSensitive(name1, name2); + compareStringsCaseInsensitive(name1, name2); } } \ No newline at end of file diff --git a/src/services/refactorProvider.ts b/src/services/refactorProvider.ts index f3504ed89b8..adb3af3ea7a 100644 --- a/src/services/refactorProvider.ts +++ b/src/services/refactorProvider.ts @@ -38,7 +38,7 @@ namespace ts { } } - export function getRefactorContextLength(context: RefactorContext): number { - return context.endPosition === undefined ? 0 : context.endPosition - context.startPosition; + export function getRefactorContextSpan({ startPosition, endPosition }: RefactorContext): TextSpan { + return createTextSpanFromBounds(startPosition, endPosition === undefined ? startPosition : endPosition); } } diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 5805a986180..354c2002179 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -8,7 +8,7 @@ namespace ts.refactor.extractSymbol { * Exported for tests. */ export function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined { - const rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: getRefactorContextLength(context) }); + const rangeToExtract = getRangeToExtract(context.file, getRefactorContextSpan(context)); const targetRange: TargetRange = rangeToExtract.targetRange; if (targetRange === undefined) { @@ -87,7 +87,7 @@ namespace ts.refactor.extractSymbol { /* Exported for tests */ export function getEditsForAction(context: RefactorContext, actionName: string): RefactorEditInfo | undefined { - const rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: getRefactorContextLength(context) }); + const rangeToExtract = getRangeToExtract(context.file, getRefactorContextSpan(context)); const targetRange: TargetRange = rangeToExtract.targetRange; const parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName); diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index 523ad97e5fa..53adfac26b3 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -11,10 +11,12 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { interface Info { container: ContainerDeclaration; isStatic: boolean; + isReadonly: boolean; type: TypeNode | undefined; declaration: AcceptedDeclaration; fieldName: AcceptedNameType; accessorName: AcceptedNameType; + originalName: AcceptedNameType; } function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined { @@ -41,21 +43,40 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { const isJS = isSourceFileJavaScript(file); const changeTracker = textChanges.ChangeTracker.fromContext(context); - const { isStatic, fieldName, accessorName, type, container, declaration } = fieldInfo; + const { isStatic, isReadonly, fieldName, accessorName, originalName, type, container, declaration } = fieldInfo; + + suppressLeadingAndTrailingTrivia(fieldName); + suppressLeadingAndTrailingTrivia(declaration); + suppressLeadingAndTrailingTrivia(container); const isInClassLike = isClassLike(container); + // avoid Readonly modifier because it will convert to get accessor + const modifierFlags = getModifierFlags(declaration) & ~ModifierFlags.Readonly; const accessorModifiers = isInClassLike - ? !declaration.modifiers || getModifierFlags(declaration) & ModifierFlags.Private ? getModifiers(isJS, isStatic, SyntaxKind.PublicKeyword) : declaration.modifiers + ? !modifierFlags || modifierFlags & ModifierFlags.Private + ? getModifiers(isJS, isStatic, SyntaxKind.PublicKeyword) + : createNodeArray(createModifiersFromModifierFlags(modifierFlags)) : undefined; const fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, SyntaxKind.PrivateKeyword) : undefined; updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers); const getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); - const setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); - + suppressLeadingAndTrailingTrivia(getAccessor); insertAccessor(changeTracker, file, getAccessor, declaration, container); - insertAccessor(changeTracker, file, setAccessor, declaration, container); + + if (isReadonly) { + // readonly modifier only existed in classLikeDeclaration + const constructor = getFirstConstructorWithBody(container); + if (constructor) { + updateReadonlyPropertyInitializerStatementConstructor(changeTracker, context, constructor, fieldName, originalName); + } + } + else { + const setAccessor = generateSetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); + suppressLeadingAndTrailingTrivia(setAccessor); + insertAccessor(changeTracker, file, setAccessor, declaration, container); + } const edits = changeTracker.getChanges(); const renameFilename = file.fileName; @@ -92,18 +113,18 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { 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; + // make sure declaration have AccessibilityModifier or Static Modifier or Readonly Modifier + const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static | ModifierFlags.Readonly; if (!declaration || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined; const fieldName = createPropertyName(getUniqueName(`_${declaration.name.text}`, file.text), declaration.name); const accessorName = createPropertyName(declaration.name.text, declaration.name); - suppressLeadingAndTrailingTrivia(fieldName); - suppressLeadingAndTrailingTrivia(declaration); return { isStatic: hasStaticModifier(declaration), + isReadonly: hasReadonlyModifier(declaration), type: getTypeAnnotationNode(declaration), container: declaration.kind === SyntaxKind.Parameter ? declaration.parent.parent : declaration.parent, + originalName: declaration.name, declaration, fieldName, accessorName, @@ -159,7 +180,6 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { declaration.type, declaration.initializer ); - changeTracker.replaceNode(file, declaration, property); } @@ -186,4 +206,24 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { ? changeTracker.insertNodeAtClassStart(file, container, accessor) : changeTracker.insertNodeAfter(file, declaration, accessor); } + + function updateReadonlyPropertyInitializerStatementConstructor(changeTracker: textChanges.ChangeTracker, context: RefactorContext, constructor: ConstructorDeclaration, fieldName: AcceptedNameType, originalName: AcceptedNameType) { + if (!constructor.body) return; + const { file, program, cancellationToken } = context; + + const referenceEntries = mapDefined(FindAllReferences.getReferenceEntriesForNode(originalName.parent.pos, originalName, program, [file], cancellationToken), entry => ( + (entry.type === "node" && rangeContainsRange(constructor, entry.node) && isIdentifier(entry.node) && isWriteAccess(entry.node)) ? entry.node : undefined + )); + + forEach(referenceEntries, entry => { + const parent = entry.parent; + const accessorName = createIdentifier(fieldName.text); + const node = isBinaryExpression(parent) + ? updateBinary(parent, accessorName, parent.right, parent.operatorToken) + : isPropertyAccessExpression(parent) + ? updatePropertyAccess(parent, parent.expression, accessorName) + : Debug.fail("Unexpected write access token"); + changeTracker.replaceNode(file, parent, node); + }); + } } diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts new file mode 100644 index 00000000000..2f5a27f87f7 --- /dev/null +++ b/src/services/refactors/moveToNewFile.ts @@ -0,0 +1,628 @@ +/* @internal */ +namespace ts.refactor { + const refactorName = "Move to a new file"; + registerRefactor(refactorName, { + getAvailableActions(context): ApplicableRefactorInfo[] { + if (!context.preferences.allowTextChangesInNewFiles || getStatementsToMove(context) === undefined) return undefined; + const description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file); + return [{ name: refactorName, description, actions: [{ name: refactorName, description }] }]; + }, + getEditsForAction(context, actionName): RefactorEditInfo { + Debug.assert(actionName === refactorName); + const statements = Debug.assertDefined(getStatementsToMove(context)); + const edits = textChanges.ChangeTracker.with(context, t => doChange(context.file, context.program, statements, t, context.host)); + return { edits, renameFilename: undefined, renameLocation: undefined }; + } + }); + + function getStatementsToMove(context: RefactorContext): ReadonlyArray | undefined { + const { file } = context; + const range = createTextRangeFromSpan(getRefactorContextSpan(context)); + const { statements } = file; + + const startNodeIndex = findIndex(statements, s => s.end > range.pos); + if (startNodeIndex === -1) return undefined; + // Can't only partially include the start node or be partially into the next node + if (range.pos > statements[startNodeIndex].getStart(file)) return undefined; + const afterEndNodeIndex = findIndex(statements, s => s.end > range.end, startNodeIndex); + // Can't be partially into the next node + if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end)) return undefined; + + return statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex); + } + + function doChange(oldFile: SourceFile, program: Program, toMove: ReadonlyArray, changes: textChanges.ChangeTracker, host: LanguageServiceHost): void { + const checker = program.getTypeChecker(); + const usage = getUsageInfo(oldFile, toMove, checker); + + const currentDirectory = getDirectoryPath(oldFile.fileName); + const extension = extensionFromPath(oldFile.fileName); + const newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host); + const newFileNameWithExtension = newModuleName + extension; + + // If previous file was global, this is easy. + changes.createNewFile(oldFile, combinePaths(currentDirectory, newFileNameWithExtension), getNewStatements(oldFile, usage, changes, toMove, program, newModuleName)); + + addNewFileToTsconfig(program, changes, oldFile.fileName, newFileNameWithExtension, hostGetCanonicalFileName(host)); + } + + function addNewFileToTsconfig(program: Program, changes: textChanges.ChangeTracker, oldFileName: string, newFileNameWithExtension: string, getCanonicalFileName: GetCanonicalFileName): void { + const cfg = program.getCompilerOptions().configFile; + if (!cfg) return; + + const newFileAbsolutePath = normalizePath(combinePaths(oldFileName, "..", newFileNameWithExtension)); + const newFilePath = getRelativePathFromFile(cfg.fileName, newFileAbsolutePath, getCanonicalFileName); + + const cfgObject = cfg.statements[0] && tryCast(cfg.statements[0].expression, isObjectLiteralExpression); + const filesProp = cfgObject && find(cfgObject.properties, (prop): prop is PropertyAssignment => + isPropertyAssignment(prop) && isStringLiteral(prop.name) && prop.name.text === "files"); + if (filesProp && isArrayLiteralExpression(filesProp.initializer)) { + changes.insertNodeInListAfter(cfg, last(filesProp.initializer.elements), createLiteral(newFilePath), filesProp.initializer.elements); + } + } + + function getNewStatements( + oldFile: SourceFile, usage: UsageInfo, changes: textChanges.ChangeTracker, toMove: ReadonlyArray, program: Program, newModuleName: string, + ): ReadonlyArray { + const checker = program.getTypeChecker(); + + if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { + changes.deleteNodeRange(oldFile, first(toMove), last(toMove)); + return toMove; + } + + const useEs6ModuleSyntax = !!oldFile.externalModuleIndicator; + const importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile, newModuleName, useEs6ModuleSyntax); + if (importsFromNewFile) { + changes.insertNodeBefore(oldFile, oldFile.statements[0], importsFromNewFile, /*blankLineBetween*/ true); + } + + deleteUnusedOldImports(oldFile, toMove, changes, usage.unusedImportsFromOldFile, checker); + changes.deleteNodeRange(oldFile, first(toMove), last(toMove)); + + updateImportsInOtherFiles(changes, program, oldFile, usage.movedSymbols, newModuleName); + + return [ + ...getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEs6ModuleSyntax), + ...addExports(oldFile, toMove, usage.oldFileImportsFromNewFile, useEs6ModuleSyntax), + ]; + } + + function deleteUnusedOldImports(oldFile: SourceFile, toMove: ReadonlyArray, changes: textChanges.ChangeTracker, toDelete: ReadonlySymbolSet, checker: TypeChecker) { + for (const statement of oldFile.statements) { + if (contains(toMove, statement)) continue; + forEachImportInStatement(statement, i => deleteUnusedImports(oldFile, i, changes, name => toDelete.has(checker.getSymbolAtLocation(name)))); + } + } + + function updateImportsInOtherFiles(changes: textChanges.ChangeTracker, program: Program, oldFile: SourceFile, movedSymbols: ReadonlySymbolSet, newModuleName: string): void { + const checker = program.getTypeChecker(); + for (const sourceFile of program.getSourceFiles()) { + if (sourceFile === oldFile) continue; + for (const statement of sourceFile.statements) { + forEachImportInStatement(statement, importNode => { + const shouldMove = (name: Identifier): boolean => { + const symbol = isBindingElement(name.parent) + ? getPropertySymbolFromBindingElement(checker, name.parent as BindingElement & { name: Identifier }) + : skipAlias(checker.getSymbolAtLocation(name), checker); + return !!symbol && movedSymbols.has(symbol); + }; + deleteUnusedImports(sourceFile, importNode, changes, shouldMove); // These will be changed to imports from the new file + const newModuleSpecifier = combinePaths(getDirectoryPath(moduleSpecifierFromImport(importNode).text), newModuleName); + const newImportDeclaration = filterImport(importNode, createLiteral(newModuleSpecifier), shouldMove); + if (newImportDeclaration) changes.insertNodeAfter(sourceFile, statement, newImportDeclaration); + }); + } + } + } + + function moduleSpecifierFromImport(i: SupportedImport): StringLiteralLike { + return (i.kind === SyntaxKind.ImportDeclaration ? i.moduleSpecifier + : i.kind === SyntaxKind.ImportEqualsDeclaration ? i.moduleReference.expression + : i.initializer.arguments[0]); + } + + function forEachImportInStatement(statement: Statement, cb: (importNode: SupportedImport) => void): void { + if (isImportDeclaration(statement)) { + if (isStringLiteral(statement.moduleSpecifier)) cb(statement as SupportedImport); + } + else if (isImportEqualsDeclaration(statement)) { + if (isExternalModuleReference(statement.moduleReference) && isStringLiteralLike(statement.moduleReference.expression)) { + cb(statement as SupportedImport); + } + } + else if (isVariableStatement(statement)) { + for (const decl of statement.declarationList.declarations) { + if (decl.initializer && isRequireCall(decl.initializer, /*checkArgumentIsStringLiteralLike*/ true)) { + cb(decl as SupportedImport); + } + } + } + } + + type SupportedImport = + | ImportDeclaration & { moduleSpecifier: StringLiteralLike } + | ImportEqualsDeclaration & { moduleReference: ExternalModuleReference & { expression: StringLiteralLike } } + | VariableDeclaration & { initializer: RequireOrImportCall }; + type SupportedImportStatement = + | ImportDeclaration + | ImportEqualsDeclaration + | VariableStatement; + + function createOldFileImportsFromNewFile(newFileNeedExport: ReadonlySymbolSet, newFileNameWithExtension: string, useEs6Imports: boolean): Statement | undefined { + let defaultImport: Identifier | undefined; + const imports: string[] = []; + newFileNeedExport.forEach(symbol => { + if (symbol.escapedName === InternalSymbolName.Default) { + defaultImport = createIdentifier(symbolNameNoDefault(symbol)); + } + else { + imports.push(symbol.name); + } + }); + return makeImportOrRequire(defaultImport, imports, newFileNameWithExtension, useEs6Imports); + } + + function makeImportOrRequire(defaultImport: Identifier | undefined, imports: ReadonlyArray, path: string, useEs6Imports: boolean): Statement | undefined { + path = ensurePathIsNonModuleName(path); + if (useEs6Imports) { + const specifiers = imports.map(i => createImportSpecifier(/*propertyName*/ undefined, createIdentifier(i))); + return makeImportIfNecessary(defaultImport, specifiers, path); + } + else { + Debug.assert(!defaultImport); // If there's a default export, it should have been an es6 module. + const bindingElements = imports.map(i => createBindingElement(/*dotDotDotToken*/ undefined, /*propertyName*/ undefined, i)); + return bindingElements.length + ? makeVariableStatement(createObjectBindingPattern(bindingElements), /*type*/ undefined, createRequireCall(createLiteral(path))) + : undefined; + } + } + + function makeVariableStatement(name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined, flags: NodeFlags = NodeFlags.Const) { + return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([createVariableDeclaration(name, type, initializer)], flags)); + } + + function createRequireCall(moduleSpecifier: StringLiteralLike): CallExpression { + return createCall(createIdentifier("require"), /*typeArguments*/ undefined, [moduleSpecifier]); + } + + function addExports(sourceFile: SourceFile, toMove: ReadonlyArray, needExport: ReadonlySymbolSet, useEs6Exports: boolean): ReadonlyArray { + return flatMap(toMove, statement => { + if (isTopLevelDeclarationStatement(statement) && + !isExported(sourceFile, statement, useEs6Exports) && + forEachTopLevelDeclaration(statement, d => needExport.has(Debug.assertDefined(d.symbol)))) { + const exports = addExport(statement, useEs6Exports); + if (exports) return exports; + } + return statement; + }); + } + + function deleteUnusedImports(sourceFile: SourceFile, importDecl: SupportedImport, changes: textChanges.ChangeTracker, isUnused: (name: Identifier) => boolean): void { + switch (importDecl.kind) { + case SyntaxKind.ImportDeclaration: + deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); + break; + case SyntaxKind.ImportEqualsDeclaration: + if (isUnused(importDecl.name)) { + changes.deleteNode(sourceFile, importDecl); + } + break; + case SyntaxKind.VariableDeclaration: + deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); + break; + default: + Debug.assertNever(importDecl); + } + } + function deleteUnusedImportsInDeclaration(sourceFile: SourceFile, importDecl: ImportDeclaration, changes: textChanges.ChangeTracker, isUnused: (name: Identifier) => boolean): void { + if (!importDecl.importClause) return; + const { name, namedBindings } = importDecl.importClause; + const defaultUnused = !name || isUnused(name); + const namedBindingsUnused = !namedBindings || + (namedBindings.kind === SyntaxKind.NamespaceImport ? isUnused(namedBindings.name) : namedBindings.elements.every(e => isUnused(e.name))); + if (defaultUnused && namedBindingsUnused) { + changes.deleteNode(sourceFile, importDecl); + } + else { + if (name && defaultUnused) { + changes.deleteNode(sourceFile, name); + } + if (namedBindings) { + if (namedBindingsUnused) { + changes.deleteNode(sourceFile, namedBindings); + } + else if (namedBindings.kind === SyntaxKind.NamedImports) { + for (const element of namedBindings.elements) { + if (isUnused(element.name)) changes.deleteNodeInList(sourceFile, element); + } + } + } + } + } + function deleteUnusedImportsInVariableDeclaration(sourceFile: SourceFile, varDecl: VariableDeclaration, changes: textChanges.ChangeTracker, isUnused: (name: Identifier) => boolean) { + const { name } = varDecl; + switch (name.kind) { + case SyntaxKind.Identifier: + if (isUnused(name)) { + changes.deleteNode(sourceFile, name); + } + break; + case SyntaxKind.ArrayBindingPattern: + break; + case SyntaxKind.ObjectBindingPattern: + if (name.elements.every(e => isIdentifier(e.name) && isUnused(e.name))) { + changes.deleteNode(sourceFile, + isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); + } + else { + for (const element of name.elements) { + if (isIdentifier(element.name) && isUnused(element.name)) { + changes.deleteNode(sourceFile, element.name); + } + } + } + break; + } + } + + function getNewFileImportsAndAddExportInOldFile( + oldFile: SourceFile, + importsToCopy: ReadonlySymbolSet, + newFileImportsFromOldFile: ReadonlySymbolSet, + changes: textChanges.ChangeTracker, + checker: TypeChecker, + useEs6ModuleSyntax: boolean, + ): ReadonlyArray { + const copiedOldImports: SupportedImportStatement[] = []; + for (const oldStatement of oldFile.statements) { + forEachImportInStatement(oldStatement, i => { + append(copiedOldImports, filterImport(i, moduleSpecifierFromImport(i), name => importsToCopy.has(checker.getSymbolAtLocation(name)))); + }); + } + + // Also, import things used from the old file, and insert 'export' modifiers as necessary in the old file. + let oldFileDefault: Identifier | undefined; + const oldFileNamedImports: string[] = []; + const markSeenTop = nodeSeenTracker(); // Needed because multiple declarations may appear in `const x = 0, y = 1;`. + newFileImportsFromOldFile.forEach(symbol => { + for (const decl of symbol.declarations) { + if (!isTopLevelDeclaration(decl)) continue; + const name = nameOfTopLevelDeclaration(decl); + if (!name) continue; + + const top = getTopLevelDeclarationStatement(decl); + if (markSeenTop(top)) { + addExportToChanges(oldFile, top, changes, useEs6ModuleSyntax); + } + if (hasModifier(decl, ModifierFlags.Default)) { + oldFileDefault = name; + } + else { + oldFileNamedImports.push(name.text); + } + } + }); + + append(copiedOldImports, makeImportOrRequire(oldFileDefault, oldFileNamedImports, removeFileExtension(getBaseFileName(oldFile.fileName)), useEs6ModuleSyntax)); + return copiedOldImports; + } + + function makeUniqueModuleName(moduleName: string, extension: string, inDirectory: string, host: LanguageServiceHost): string { + let newModuleName = moduleName; + for (let i = 1; ; i++) { + const name = combinePaths(inDirectory, newModuleName + extension); + if (!host.fileExists(name)) return newModuleName; + newModuleName = `${moduleName}.${i}`; + } + } + + function getNewModuleName(movedSymbols: ReadonlySymbolSet): string { + return movedSymbols.forEachEntry(symbolNameNoDefault) || "newFile"; + } + + interface UsageInfo { + // Symbols whose declarations are moved from the old file to the new file. + readonly movedSymbols: ReadonlySymbolSet; + + // Symbols declared in the old file that must be imported by the new file. (May not already be exported.) + readonly newFileImportsFromOldFile: ReadonlySymbolSet; + // Subset of movedSymbols that are still used elsewhere in the old file and must be imported back. + readonly oldFileImportsFromNewFile: ReadonlySymbolSet; + + readonly oldImportsNeededByNewFile: ReadonlySymbolSet; + // Subset of oldImportsNeededByNewFile that are will no longer be used in the old file. + readonly unusedImportsFromOldFile: ReadonlySymbolSet; + } + function getUsageInfo(oldFile: SourceFile, toMove: ReadonlyArray, checker: TypeChecker): UsageInfo { + const movedSymbols = new SymbolSet(); + const oldImportsNeededByNewFile = new SymbolSet(); + const newFileImportsFromOldFile = new SymbolSet(); + + for (const statement of toMove) { + forEachTopLevelDeclaration(statement, decl => { + movedSymbols.add(Debug.assertDefined(isExpressionStatement(decl) ? checker.getSymbolAtLocation(decl.expression.left) : decl.symbol)); + }); + } + for (const statement of toMove) { + forEachReference(statement, checker, symbol => { + if (!symbol.declarations) return; + for (const decl of symbol.declarations) { + if (isInImport(decl)) { + oldImportsNeededByNewFile.add(symbol); + } + else if (isTopLevelDeclaration(decl) && !movedSymbols.has(symbol)) { + newFileImportsFromOldFile.add(symbol); + } + } + }); + } + + const unusedImportsFromOldFile = oldImportsNeededByNewFile.clone(); + + const oldFileImportsFromNewFile = new SymbolSet(); + for (const statement of oldFile.statements) { + if (contains(toMove, statement)) continue; + + forEachReference(statement, checker, symbol => { + if (movedSymbols.has(symbol)) oldFileImportsFromNewFile.add(symbol); + unusedImportsFromOldFile.delete(symbol); + }); + } + + return { movedSymbols, newFileImportsFromOldFile, oldFileImportsFromNewFile, oldImportsNeededByNewFile, unusedImportsFromOldFile }; + } + + // Below should all be utilities + + function isInImport(decl: Declaration) { + switch (decl.kind) { + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportClause: + return true; + case SyntaxKind.VariableDeclaration: + return isVariableDeclarationInImport(decl as VariableDeclaration); + case SyntaxKind.BindingElement: + return isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); + default: + return false; + } + } + function isVariableDeclarationInImport(decl: VariableDeclaration) { + return isSourceFile(decl.parent.parent.parent) && + isRequireCall(decl.initializer, /*checkArgumentIsStringLiteralLike*/ true); + } + + function filterImport(i: SupportedImport, moduleSpecifier: StringLiteralLike, keep: (name: Identifier) => boolean): SupportedImportStatement | undefined { + switch (i.kind) { + case SyntaxKind.ImportDeclaration: { + const clause = i.importClause; + const defaultImport = clause.name && keep(clause.name) ? clause.name : undefined; + const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); + return defaultImport || namedBindings + ? createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createImportClause(defaultImport, namedBindings), moduleSpecifier) + : undefined; + } + case SyntaxKind.ImportEqualsDeclaration: + return keep(i.name) ? i : undefined; + case SyntaxKind.VariableDeclaration: { + const name = filterBindingName(i.name, keep); + return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; + } + default: + return Debug.assertNever(i); + } + } + function filterNamedBindings(namedBindings: NamedImportBindings, keep: (name: Identifier) => boolean): NamedImportBindings | undefined { + if (namedBindings.kind === SyntaxKind.NamespaceImport) { + return keep(namedBindings.name) ? namedBindings : undefined; + } + else { + const newElements = namedBindings.elements.filter(e => keep(e.name)); + return newElements.length ? createNamedImports(newElements) : undefined; + } + } + function filterBindingName(name: BindingName, keep: (name: Identifier) => boolean): BindingName | undefined { + switch (name.kind) { + case SyntaxKind.Identifier: + return keep(name) ? name : undefined; + case SyntaxKind.ArrayBindingPattern: + return name; + case SyntaxKind.ObjectBindingPattern: { + // We can't handle nested destructurings or property names well here, so just copy them all. + const newElements = name.elements.filter(prop => prop.propertyName || !isIdentifier(prop.name) || keep(prop.name)); + return newElements.length ? createObjectBindingPattern(newElements) : undefined; + } + } + } + + function forEachReference(node: Node, checker: TypeChecker, onReference: (s: Symbol) => void) { + node.forEachChild(function cb(node) { + if (isIdentifier(node) && !isDeclarationName(node)) { + const sym = checker.getSymbolAtLocation(node); + if (sym) onReference(sym); + } + else { + node.forEachChild(cb); + } + }); + } + + interface ReadonlySymbolSet { + has(symbol: Symbol): boolean; + forEach(cb: (symbol: Symbol) => void): void; + forEachEntry(cb: (symbol: Symbol) => T | undefined): T | undefined; + } + class SymbolSet implements ReadonlySymbolSet { + private map = createMap(); + add(symbol: Symbol): void { + this.map.set(String(getSymbolId(symbol)), symbol); + } + has(symbol: Symbol): boolean { + return this.map.has(String(getSymbolId(symbol))); + } + delete(symbol: Symbol): void { + this.map.delete(String(getSymbolId(symbol))); + } + forEach(cb: (symbol: Symbol) => void): void { + this.map.forEach(cb); + } + forEachEntry(cb: (symbol: Symbol) => T | undefined): T | undefined { + return forEachEntry(this.map, cb); + } + clone(): SymbolSet { + const clone = new SymbolSet(); + copyEntries(this.map, clone.map); + return clone; + } + } + + type TopLevelExpressionStatement = ExpressionStatement & { expression: BinaryExpression & { left: PropertyAccessExpression } }; // 'exports.x = ...' + type NonVariableTopLevelDeclaration = + | FunctionDeclaration + | ClassDeclaration + | EnumDeclaration + | TypeAliasDeclaration + | InterfaceDeclaration + | ModuleDeclaration + | TopLevelExpressionStatement + | ImportEqualsDeclaration; + type TopLevelDeclarationStatement = NonVariableTopLevelDeclaration | VariableStatement; + interface TopLevelVariableDeclaration extends VariableDeclaration { parent: VariableDeclarationList & { parent: VariableStatement; }; } + type TopLevelDeclaration = NonVariableTopLevelDeclaration | TopLevelVariableDeclaration; + function isTopLevelDeclaration(node: Node): node is TopLevelDeclaration { + return isNonVariableTopLevelDeclaration(node) || isVariableDeclaration(node) && isSourceFile(node.parent.parent.parent); + } + + function isTopLevelDeclarationStatement(node: Node): node is TopLevelDeclarationStatement { + Debug.assert(isSourceFile(node.parent)); + return isNonVariableTopLevelDeclaration(node) || isVariableStatement(node); + } + + function isNonVariableTopLevelDeclaration(node: Node): node is NonVariableTopLevelDeclaration { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + return true; + default: + return false; + } + } + + function forEachTopLevelDeclaration(statement: Statement, cb: (node: TopLevelDeclaration) => T): T { + switch (statement.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + return cb(statement as FunctionDeclaration | ClassDeclaration | EnumDeclaration | ModuleDeclaration | TypeAliasDeclaration | InterfaceDeclaration | ImportEqualsDeclaration); + + case SyntaxKind.VariableStatement: + return forEach((statement as VariableStatement).declarationList.declarations as ReadonlyArray, cb); + + case SyntaxKind.ExpressionStatement: { + const { expression } = statement as ExpressionStatement; + return isBinaryExpression(expression) && getSpecialPropertyAssignmentKind(expression) === SpecialPropertyAssignmentKind.ExportsProperty + ? cb(statement as TopLevelExpressionStatement) + : undefined; + } + } + } + + function nameOfTopLevelDeclaration(d: TopLevelDeclaration): Identifier | undefined { + return d.kind === SyntaxKind.ExpressionStatement ? d.expression.left.name : tryCast(d.name, isIdentifier); + } + + function getTopLevelDeclarationStatement(d: TopLevelDeclaration): TopLevelDeclarationStatement { + return isVariableDeclaration(d) ? d.parent.parent : d; + } + + function addExportToChanges(sourceFile: SourceFile, decl: TopLevelDeclarationStatement, changes: textChanges.ChangeTracker, useEs6Exports: boolean): void { + if (isExported(sourceFile, decl, useEs6Exports)) return; + if (useEs6Exports) { + if (!isExpressionStatement(decl)) changes.insertExportModifier(sourceFile, decl); + } + else { + const names = getNamesToExportInCommonJS(decl); + if (names.length !== 0) changes.insertNodesAfter(sourceFile, decl, names.map(createExportAssignment)); + } + } + + function isExported(sourceFile: SourceFile, decl: TopLevelDeclarationStatement, useEs6Exports: boolean): boolean { + if (useEs6Exports) { + return !isExpressionStatement(decl) && hasModifier(decl, ModifierFlags.Export); + } + else { + return getNamesToExportInCommonJS(decl).some(name => sourceFile.symbol.exports.has(escapeLeadingUnderscores(name))); + } + } + + function addExport(decl: TopLevelDeclarationStatement, useEs6Exports: boolean): ReadonlyArray | undefined { + return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); + } + function addEs6Export(d: TopLevelDeclarationStatement): TopLevelDeclarationStatement { + const modifiers = concatenate([createModifier(SyntaxKind.ExportKeyword)], d.modifiers); + switch (d.kind) { + case SyntaxKind.FunctionDeclaration: + return updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); + case SyntaxKind.ClassDeclaration: + return updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); + case SyntaxKind.VariableStatement: + return updateVariableStatement(d, modifiers, d.declarationList); + case SyntaxKind.ModuleDeclaration: + return updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body); + case SyntaxKind.EnumDeclaration: + return updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members); + case SyntaxKind.TypeAliasDeclaration: + return updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type); + case SyntaxKind.InterfaceDeclaration: + return updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); + case SyntaxKind.ImportEqualsDeclaration: + return updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference); + case SyntaxKind.ExpressionStatement: + return Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` + default: + return Debug.assertNever(d); + } + } + function addCommonjsExport(decl: TopLevelDeclarationStatement): ReadonlyArray | undefined { + return [decl, ...getNamesToExportInCommonJS(decl).map(createExportAssignment)]; + } + function getNamesToExportInCommonJS(decl: TopLevelDeclarationStatement): ReadonlyArray { + switch (decl.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ClassDeclaration: + return [decl.name.text]; + case SyntaxKind.VariableStatement: + return mapDefined(decl.declarationList.declarations, d => isIdentifier(d.name) ? d.name.text : undefined); + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + return undefined; + case SyntaxKind.ExpressionStatement: + return Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` + default: + Debug.assertNever(decl); + } + } + + /** Creates `exports.x = x;` */ + function createExportAssignment(name: string): Statement { + return createExpressionStatement( + createBinary( + createPropertyAccess(createIdentifier("exports"), createIdentifier(name)), + SyntaxKind.EqualsToken, + createIdentifier(name))); + } +} diff --git a/src/services/rename.ts b/src/services/rename.ts index 2f9de0c0cad..0fd7ce5e7b5 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -36,6 +36,9 @@ namespace ts.Rename { return undefined; } + // Can't rename a module name. + if (isStringLiteralLike(node) && tryGetImportFromModuleSpecifier(node)) return undefined; + const kind = SymbolDisplay.getSymbolKind(typeChecker, symbol, node); const specifierName = (isImportOrExportSpecifierName(node) || isStringOrNumericLiteral(node) && node.parent.kind === SyntaxKind.ComputedPropertyName) ? stripQuotes(getTextOfIdentifierOrLiteral(node)) diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index eca1c639196..de588120db1 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -211,6 +211,7 @@ namespace ts.textChanges { export class ChangeTracker { private readonly changes: Change[] = []; + private readonly newFiles: { readonly oldFile: SourceFile, readonly fileName: string, readonly statements: ReadonlyArray }[] = []; private readonly deletedNodesInLists: true[] = []; // Stores ids of nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`. private readonly classesWithNodesInsertedAtStart = createMap(); // Set implemented as Map @@ -463,7 +464,17 @@ namespace ts.textChanges { } } - public insertNodeAfter(sourceFile: SourceFile, after: Node, newNode: Node): this { + public insertNodeAfter(sourceFile: SourceFile, after: Node, newNode: Node): void { + const endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode); + this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)); + } + + public insertNodesAfter(sourceFile: SourceFile, after: Node, newNodes: ReadonlyArray): void { + const endPosition = this.insertNodeAfterWorker(sourceFile, after, first(newNodes)); + this.insertNodesAt(sourceFile, endPosition, newNodes, this.getInsertNodeAfterOptions(sourceFile, after)); + } + + private insertNodeAfterWorker(sourceFile: SourceFile, after: Node, newNode: Node): number { 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 @@ -472,14 +483,17 @@ namespace ts.textChanges { } } const endPosition = getAdjustedEndPosition(sourceFile, after, {}); - const options = this.getInsertNodeAfterOptions(after); - return this.replaceRange(sourceFile, createTextRange(endPosition), newNode, { - ...options, - prefix: after.end === sourceFile.end && isStatement(after) ? (options.prefix ? `\n${options.prefix}` : "\n") : options.prefix, - }); + return endPosition; } - private getInsertNodeAfterOptions(node: Node): InsertNodeOptions { + private getInsertNodeAfterOptions(sourceFile: SourceFile, after: Node) { + const options = this.getInsertNodeAfterOptionsWorker(after); + return { + ...options, + prefix: after.end === sourceFile.end && isStatement(after) ? (options.prefix ? `\n${options.prefix}` : "\n") : options.prefix, + }; + } + private getInsertNodeAfterOptionsWorker(node: Node): InsertNodeOptions { if (isClassDeclaration(node) || isModuleDeclaration(node)) { return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; } @@ -527,13 +541,16 @@ namespace ts.textChanges { } } + public insertExportModifier(sourceFile: SourceFile, node: DeclarationStatement | VariableStatement): void { + this.insertText(sourceFile, node.getStart(sourceFile), "export "); + } + /** * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, * i.e. arguments in arguments lists, parameters in parameter lists etc. * Note that separators are part of the node in statements and class elements. */ - public insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node) { - const containingList = formatting.SmartIndenter.getContainingList(after, sourceFile); + public insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node, containingList = formatting.SmartIndenter.getContainingList(after, sourceFile)) { if (!containingList) { Debug.fail("node is not a list element"); return this; @@ -664,7 +681,15 @@ namespace ts.textChanges { */ public getChanges(validate?: ValidateNonFormattedText): FileTextChanges[] { this.finishClassesWithNodesInsertedAtStart(); - return changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate); + const changes = changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate); + for (const { oldFile, fileName, statements } of this.newFiles) { + changes.push(changesToText.newFileChanges(oldFile, fileName, statements, this.newLineCharacter)); + } + return changes; + } + + public createNewFile(oldFile: SourceFile, fileName: string, statements: ReadonlyArray) { + this.newFiles.push({ oldFile, fileName, statements }); } } @@ -679,7 +704,8 @@ namespace ts.textChanges { return group(changes, c => c.sourceFile.path).map(changesInFile => { const sourceFile = changesInFile[0].sourceFile; // order changes by start position - const normalized = stableSort(changesInFile, (a, b) => a.range.pos - b.range.pos); + // If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa. + const normalized = stableSort(changesInFile, (a, b) => (a.range.pos - b.range.pos) || (a.range.end - b.range.end)); // verify that change intervals do not overlap, except possibly at end points. for (let i = 0; i < normalized.length - 1; i++) { Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", () => @@ -691,6 +717,11 @@ namespace ts.textChanges { }); } + export function newFileChanges(oldFile: SourceFile, fileName: string, statements: ReadonlyArray, newLineCharacter: string): FileTextChanges { + const text = statements.map(s => getNonformattedText(s, oldFile, newLineCharacter).text).join(newLineCharacter); + return { fileName, textChanges: [createTextChange(createTextSpan(0, 0), text)] }; + } + function computeNewText(change: Change, sourceFile: SourceFile, newLineCharacter: string, formatContext: formatting.FormatContext, validate: ValidateNonFormattedText): string { if (change.kind === ChangeKind.Remove) { return ""; diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index be46c21e06b..0fe4b16e2ac 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -98,6 +98,7 @@ "codefixes/fixExtendsInterfaceBecomesImplements.ts", "codefixes/fixForgottenThisPropertyAccess.ts", "codefixes/fixUnusedIdentifier.ts", + "codefixes/fixUnreachableCode.ts", "codefixes/fixJSDocTypes.ts", "codefixes/fixAwaitInSyncFunction.ts", "codefixes/disableJsDiagnostics.ts", @@ -105,10 +106,12 @@ "codefixes/inferFromUsage.ts", "codefixes/fixInvalidImportSyntax.ts", "codefixes/fixStrictClassInitialization.ts", + "codefixes/moduleSpecifiers.ts", "codefixes/requireInTs.ts", "codefixes/useDefaultImport.ts", "refactors/extractSymbol.ts", "refactors/generateGetAccessorAndSetAccessor.ts", + "refactors/moveToNewFile.ts", "sourcemaps.ts", "services.ts", "breakpoints.ts", diff --git a/src/services/types.ts b/src/services/types.ts index 96a364eb957..2f89e7cc099 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -13,7 +13,7 @@ namespace ts { getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; getFullStart(): number; getEnd(): number; - getWidth(sourceFile?: SourceFile): number; + getWidth(sourceFile?: SourceFileLike): number; getFullWidth(): number; getLeadingTriviaWidth(sourceFile?: SourceFile): number; getFullText(sourceFile?: SourceFile): string; @@ -236,6 +236,7 @@ namespace ts { readonly includeCompletionsForModuleExports?: boolean; readonly includeCompletionsWithInsertText?: boolean; readonly importModuleSpecifierPreference?: "relative" | "non-relative"; + readonly allowTextChangesInNewFiles?: boolean; } /* @internal */ export const defaultPreferences: UserPreferences = {}; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 3d50ded1886..228af7afdb9 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -107,6 +107,10 @@ namespace ts { Debug.assert(isJSDocTemplateTag(node.parent.parent)); // Else would be handled by isDeclarationName return SemanticMeaning.Type; } + else if (isLiteralTypeNode(node.parent)) { + // This might be T["name"], which is actually referencing a property and not a type. So allow both meanings. + return SemanticMeaning.Type | SemanticMeaning.Value; + } else { return SemanticMeaning.Value; } @@ -707,7 +711,7 @@ namespace ts { return findPrecedingToken(position, file); } - export function findNextToken(previousToken: Node, parent: Node): Node { + export function findNextToken(previousToken: Node, parent: Node, sourceFile: SourceFile): Node { return find(parent); function find(n: Node): Node { @@ -724,7 +728,7 @@ namespace ts { // previous token ends exactly at the beginning of child (child.pos === previousToken.end); - if (shouldDiveInChildNode && nodeHasTokens(child)) { + if (shouldDiveInChildNode && nodeHasTokens(child, sourceFile)) { return find(child); } } @@ -759,12 +763,12 @@ namespace ts { const start = child.getStart(sourceFile, includeJsDoc); const lookInPreviousChild = (start >= position) || // cursor in the leading trivia - !nodeHasTokens(child) || + !nodeHasTokens(child, sourceFile) || isWhiteSpaceOnlyJsxText(child); if (lookInPreviousChild) { // actual start of the node is past the position - previous token should be at the end of previous child - const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile); return candidate && findRightmostToken(candidate, sourceFile); } else { @@ -781,7 +785,7 @@ namespace ts { // Try to find the rightmost token in the file without filtering. // Namely we are skipping the check: 'position < node.end' if (children.length) { - const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile); return candidate && findRightmostToken(candidate, sourceFile); } } @@ -797,21 +801,21 @@ namespace ts { } const children = n.getChildren(sourceFile); - const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile); return candidate && findRightmostToken(candidate, sourceFile); } /** * Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens. */ - function findRightmostChildNodeWithTokens(children: Node[], exclusiveStartPosition: number): Node | undefined { + function findRightmostChildNodeWithTokens(children: Node[], exclusiveStartPosition: number, sourceFile: SourceFile): Node | undefined { for (let i = exclusiveStartPosition - 1; i >= 0; i--) { const child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { Debug.assert(i > 0, "`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } - else if (nodeHasTokens(children[i])) { + else if (nodeHasTokens(children[i], sourceFile)) { return children[i]; } } @@ -1022,10 +1026,10 @@ namespace ts { } } - function nodeHasTokens(n: Node): boolean { + function nodeHasTokens(n: Node, sourceFile: SourceFileLike): boolean { // If we have a token or node that has a non-zero width, it must have tokens. // Note: getWidth() does not take trivia into account. - return n.getWidth() !== 0; + return n.getWidth(sourceFile) !== 0; } export function getNodeModifiers(node: Node): string { @@ -1146,6 +1150,10 @@ namespace ts { return createTextSpanFromBounds(range.pos, range.end); } + export function createTextRangeFromSpan(span: TextSpan): TextRange { + return createTextRange(span.start, span.start + span.length); + } + export function createTextChangeFromStartLength(start: number, length: number, newText: string): TextChange { return createTextChange(createTextSpan(start, length), newText); } @@ -1225,6 +1233,47 @@ namespace ts { export function hostGetCanonicalFileName(host: LanguageServiceHost): GetCanonicalFileName { return createGetCanonicalFileName(hostUsesCaseSensitiveFileNames(host)); } + + export function makeImportIfNecessary(defaultImport: Identifier | undefined, namedImports: ReadonlyArray | undefined, moduleSpecifier: string): ImportDeclaration | undefined { + return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier) : undefined; + } + + export function makeImport(defaultImport: Identifier | undefined, namedImports: ReadonlyArray | undefined, moduleSpecifier: string | Expression): ImportDeclaration { + return createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + defaultImport || namedImports + ? createImportClause(defaultImport, namedImports && namedImports.length ? createNamedImports(namedImports) : undefined) + : undefined, + typeof moduleSpecifier === "string" ? createLiteral(moduleSpecifier) : moduleSpecifier); + } + + export function symbolNameNoDefault(symbol: Symbol): string | undefined { + const escaped = symbolEscapedNameNoDefault(symbol); + return escaped === undefined ? undefined : unescapeLeadingUnderscores(escaped); + } + + export function symbolEscapedNameNoDefault(symbol: Symbol): __String | undefined { + if (symbol.escapedName !== InternalSymbolName.Default) { + return symbol.escapedName; + } + + return firstDefined(symbol.declarations, decl => { + const name = getNameOfDeclaration(decl); + return name && name.kind === SyntaxKind.Identifier ? name.escapedText : undefined; + }); + } + + export function getPropertySymbolFromBindingElement(checker: TypeChecker, bindingElement: BindingElement & { name: Identifier }) { + const typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + const propSymbol = typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + if (propSymbol && propSymbol.flags & SymbolFlags.Accessor) { + // See GH#16922 + Debug.assert(!!(propSymbol.flags & SymbolFlags.Transient)); + return (propSymbol as TransientSymbol).target; + } + return propSymbol; + } } // Display-part writer helpers diff --git a/tests/baselines/reference/DeclarationErrorsNoEmitOnError.errors.txt b/tests/baselines/reference/DeclarationErrorsNoEmitOnError.errors.txt deleted file mode 100644 index 0a8f03a504a..00000000000 --- a/tests/baselines/reference/DeclarationErrorsNoEmitOnError.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts(3,8): error TS4033: Property 'f' of exported interface has or is using private name 'T'. - - -==== tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts (1 errors) ==== - type T = { x : number } - export interface I { - f: T; - ~ -!!! error TS4033: Property 'f' of exported interface has or is using private name 'T'. - } \ No newline at end of file diff --git a/tests/baselines/reference/DeclarationErrorsNoEmitOnError.js b/tests/baselines/reference/DeclarationErrorsNoEmitOnError.js new file mode 100644 index 00000000000..73c312a018b --- /dev/null +++ b/tests/baselines/reference/DeclarationErrorsNoEmitOnError.js @@ -0,0 +1,19 @@ +//// [DeclarationErrorsNoEmitOnError.ts] +type T = { x : number } +export interface I { + f: T; +} + +//// [DeclarationErrorsNoEmitOnError.js] +"use strict"; +exports.__esModule = true; + + +//// [DeclarationErrorsNoEmitOnError.d.ts] +declare type T = { + x: number; +}; +export interface I { + f: T; +} +export {}; diff --git a/tests/baselines/reference/DeclarationErrorsNoEmitOnError.types b/tests/baselines/reference/DeclarationErrorsNoEmitOnError.types index 08a65d9c146..d2598dfe748 100644 --- a/tests/baselines/reference/DeclarationErrorsNoEmitOnError.types +++ b/tests/baselines/reference/DeclarationErrorsNoEmitOnError.types @@ -1,12 +1,12 @@ === tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts === type T = { x : number } ->T : { x: number; } +>T : T >x : number export interface I { >I : I f: T; ->f : { x: number; } ->T : { x: number; } +>f : T +>T : T } diff --git a/tests/baselines/reference/ES5For-of30.js b/tests/baselines/reference/ES5For-of30.js index fead25e7cf0..2ee498efab4 100644 --- a/tests/baselines/reference/ES5For-of30.js +++ b/tests/baselines/reference/ES5For-of30.js @@ -7,6 +7,7 @@ for ([a = 1, b = ""] of tuple) { } //// [ES5For-of30.js] +var _a, _b, _c; var a, b; var tuple = [2, "3"]; for (var _i = 0, tuple_1 = tuple; _i < tuple_1.length; _i++) { @@ -14,4 +15,3 @@ for (var _i = 0, tuple_1 = tuple; _i < tuple_1.length; _i++) { a; b; } -var _a, _b, _c; diff --git a/tests/baselines/reference/ES5For-of31.js b/tests/baselines/reference/ES5For-of31.js index 6b038e377cb..23cee8bff42 100644 --- a/tests/baselines/reference/ES5For-of31.js +++ b/tests/baselines/reference/ES5For-of31.js @@ -7,10 +7,10 @@ for ({ a: b = 1, b: a = ""} of []) { } //// [ES5For-of31.js] +var _a, _b, _c; var a, b; -for (var _i = 0, _a = []; _i < _a.length; _i++) { - _b = _a[_i], _c = _b.a, b = _c === void 0 ? 1 : _c, _d = _b.b, a = _d === void 0 ? "" : _d; +for (var _i = 0, _d = []; _i < _d.length; _i++) { + _a = _d[_i], _b = _a.a, b = _b === void 0 ? 1 : _b, _c = _a.b, a = _c === void 0 ? "" : _c; a; b; } -var _b, _c, _d; diff --git a/tests/baselines/reference/ES5For-of33.js b/tests/baselines/reference/ES5For-of33.js index 729c37b8120..8a7bacbf52d 100644 --- a/tests/baselines/reference/ES5For-of33.js +++ b/tests/baselines/reference/ES5For-of33.js @@ -14,18 +14,18 @@ var __values = (this && this.__values) || function (o) { } }; }; +var e_1, _a; try { - for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { - var v = _b.value; + for (var _b = __values(['a', 'b', 'c']), _c = _b.next(); !_c.done; _c = _b.next()) { + var v = _c.value; console.log(v); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); + if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); } finally { if (e_1) throw e_1.error; } } -var e_1, _c; //# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.js.map b/tests/baselines/reference/ES5For-of33.js.map index 7174a7ab6a9..c2a28ecec79 100644 --- a/tests/baselines/reference/ES5For-of33.js.map +++ b/tests/baselines/reference/ES5For-of33.js.map @@ -1,2 +1,2 @@ //// [ES5For-of33.js.map] -{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,KAAc,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"} \ No newline at end of file +{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,KAAc,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.sourcemap.txt b/tests/baselines/reference/ES5For-of33.sourcemap.txt index 981750750c0..8438d558c74 100644 --- a/tests/baselines/reference/ES5For-of33.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of33.sourcemap.txt @@ -18,8 +18,9 @@ sourceFile:ES5For-of33.ts >>> } >>> }; >>>}; +>>>var e_1, _a; >>>try { ->>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { +>>> for (var _b = __values(['a', 'b', 'c']), _c = _b.next(); !_c.done; _c = _b.next()) { 1 >^^^^ 2 > ^^^^^ 3 > ^^^^ @@ -50,23 +51,23 @@ sourceFile:ES5For-of33.ts 13> 14> 15> ) -1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(12, 10) Source(1, 15) + SourceIndex(0) -3 >Emitted(12, 14) Source(1, 15) + SourceIndex(0) -4 >Emitted(12, 19) Source(1, 15) + SourceIndex(0) -5 >Emitted(12, 28) Source(1, 15) + SourceIndex(0) -6 >Emitted(12, 29) Source(1, 16) + SourceIndex(0) -7 >Emitted(12, 32) Source(1, 19) + SourceIndex(0) -8 >Emitted(12, 34) Source(1, 21) + SourceIndex(0) -9 >Emitted(12, 37) Source(1, 24) + SourceIndex(0) -10>Emitted(12, 39) Source(1, 26) + SourceIndex(0) -11>Emitted(12, 42) Source(1, 29) + SourceIndex(0) -12>Emitted(12, 43) Source(1, 30) + SourceIndex(0) -13>Emitted(12, 44) Source(1, 30) + SourceIndex(0) -14>Emitted(12, 60) Source(1, 30) + SourceIndex(0) -15>Emitted(12, 88) Source(1, 32) + SourceIndex(0) +1 >Emitted(13, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(13, 10) Source(1, 15) + SourceIndex(0) +3 >Emitted(13, 14) Source(1, 15) + SourceIndex(0) +4 >Emitted(13, 19) Source(1, 15) + SourceIndex(0) +5 >Emitted(13, 28) Source(1, 15) + SourceIndex(0) +6 >Emitted(13, 29) Source(1, 16) + SourceIndex(0) +7 >Emitted(13, 32) Source(1, 19) + SourceIndex(0) +8 >Emitted(13, 34) Source(1, 21) + SourceIndex(0) +9 >Emitted(13, 37) Source(1, 24) + SourceIndex(0) +10>Emitted(13, 39) Source(1, 26) + SourceIndex(0) +11>Emitted(13, 42) Source(1, 29) + SourceIndex(0) +12>Emitted(13, 43) Source(1, 30) + SourceIndex(0) +13>Emitted(13, 44) Source(1, 30) + SourceIndex(0) +14>Emitted(13, 60) Source(1, 30) + SourceIndex(0) +15>Emitted(13, 88) Source(1, 32) + SourceIndex(0) --- ->>> var v = _b.value; +>>> var v = _c.value; 1 >^^^^^^^^ 2 > ^^^^ 3 > ^ @@ -75,10 +76,10 @@ sourceFile:ES5For-of33.ts 2 > var 3 > v 4 > -1 >Emitted(13, 9) Source(1, 6) + SourceIndex(0) -2 >Emitted(13, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(13, 14) Source(1, 11) + SourceIndex(0) -4 >Emitted(13, 25) Source(1, 11) + SourceIndex(0) +1 >Emitted(14, 9) Source(1, 6) + SourceIndex(0) +2 >Emitted(14, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(14, 14) Source(1, 11) + SourceIndex(0) +4 >Emitted(14, 25) Source(1, 11) + SourceIndex(0) --- >>> console.log(v); 1 >^^^^^^^^ @@ -98,28 +99,27 @@ sourceFile:ES5For-of33.ts 6 > v 7 > ) 8 > ; -1 >Emitted(14, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(14, 16) Source(2, 12) + SourceIndex(0) -3 >Emitted(14, 17) Source(2, 13) + SourceIndex(0) -4 >Emitted(14, 20) Source(2, 16) + SourceIndex(0) -5 >Emitted(14, 21) Source(2, 17) + SourceIndex(0) -6 >Emitted(14, 22) Source(2, 18) + SourceIndex(0) -7 >Emitted(14, 23) Source(2, 19) + SourceIndex(0) -8 >Emitted(14, 24) Source(2, 20) + SourceIndex(0) +1 >Emitted(15, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(15, 16) Source(2, 12) + SourceIndex(0) +3 >Emitted(15, 17) Source(2, 13) + SourceIndex(0) +4 >Emitted(15, 20) Source(2, 16) + SourceIndex(0) +5 >Emitted(15, 21) Source(2, 17) + SourceIndex(0) +6 >Emitted(15, 22) Source(2, 18) + SourceIndex(0) +7 >Emitted(15, 23) Source(2, 19) + SourceIndex(0) +8 >Emitted(15, 24) Source(2, 20) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(15, 6) Source(3, 2) + SourceIndex(0) +1 >Emitted(16, 6) Source(3, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { >>> try { ->>> if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); +>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); >>> } >>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1, _c; >>>//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js b/tests/baselines/reference/ES5For-of34.js index 307a7505d09..821cec60ee1 100644 --- a/tests/baselines/reference/ES5For-of34.js +++ b/tests/baselines/reference/ES5For-of34.js @@ -17,21 +17,21 @@ var __values = (this && this.__values) || function (o) { } }; }; +var e_1, _a; function foo() { return { x: 0 }; } try { - for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { - foo().x = _b.value; + for (var _b = __values(['a', 'b', 'c']), _c = _b.next(); !_c.done; _c = _b.next()) { + foo().x = _c.value; var p = foo().x; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); + if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); } finally { if (e_1) throw e_1.error; } } -var e_1, _c; //# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js.map b/tests/baselines/reference/ES5For-of34.js.map index 15cbe915a81..ac81f9749c9 100644 --- a/tests/baselines/reference/ES5For-of34.js.map +++ b/tests/baselines/reference/ES5For-of34.js.map @@ -1,2 +1,2 @@ //// [ES5For-of34.js.map] -{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IACI,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,KAAgB,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA5B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"} \ No newline at end of file +{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;IACI,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,KAAgB,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA5B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.sourcemap.txt b/tests/baselines/reference/ES5For-of34.sourcemap.txt index 86bd08aa1f6..ea1b982e766 100644 --- a/tests/baselines/reference/ES5For-of34.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of34.sourcemap.txt @@ -18,11 +18,12 @@ sourceFile:ES5For-of34.ts >>> } >>> }; >>>}; +>>>var e_1, _a; >>>function foo() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(11, 1) Source(1, 1) + SourceIndex(0) +1 >Emitted(12, 1) Source(1, 1) + SourceIndex(0) --- >>> return { x: 0 }; 1->^^^^ @@ -42,14 +43,14 @@ sourceFile:ES5For-of34.ts 6 > 0 7 > } 8 > ; -1->Emitted(12, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(12, 12) Source(2, 12) + SourceIndex(0) -3 >Emitted(12, 14) Source(2, 14) + SourceIndex(0) -4 >Emitted(12, 15) Source(2, 15) + SourceIndex(0) -5 >Emitted(12, 17) Source(2, 17) + SourceIndex(0) -6 >Emitted(12, 18) Source(2, 18) + SourceIndex(0) -7 >Emitted(12, 20) Source(2, 20) + SourceIndex(0) -8 >Emitted(12, 21) Source(2, 21) + SourceIndex(0) +1->Emitted(13, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(13, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(13, 14) Source(2, 14) + SourceIndex(0) +4 >Emitted(13, 15) Source(2, 15) + SourceIndex(0) +5 >Emitted(13, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(13, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(13, 20) Source(2, 20) + SourceIndex(0) +8 >Emitted(13, 21) Source(2, 21) + SourceIndex(0) --- >>>} 1 > @@ -58,11 +59,11 @@ sourceFile:ES5For-of34.ts 1 > > 2 >} -1 >Emitted(13, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(13, 2) Source(3, 2) + SourceIndex(0) +1 >Emitted(14, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(3, 2) + SourceIndex(0) --- >>>try { ->>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { +>>> for (var _b = __values(['a', 'b', 'c']), _c = _b.next(); !_c.done; _c = _b.next()) { 1->^^^^ 2 > ^^^^^ 3 > ^^^^ @@ -94,23 +95,23 @@ sourceFile:ES5For-of34.ts 13> 14> 15> ) -1->Emitted(15, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(15, 10) Source(4, 17) + SourceIndex(0) -3 >Emitted(15, 14) Source(4, 17) + SourceIndex(0) -4 >Emitted(15, 19) Source(4, 17) + SourceIndex(0) -5 >Emitted(15, 28) Source(4, 17) + SourceIndex(0) -6 >Emitted(15, 29) Source(4, 18) + SourceIndex(0) -7 >Emitted(15, 32) Source(4, 21) + SourceIndex(0) -8 >Emitted(15, 34) Source(4, 23) + SourceIndex(0) -9 >Emitted(15, 37) Source(4, 26) + SourceIndex(0) -10>Emitted(15, 39) Source(4, 28) + SourceIndex(0) -11>Emitted(15, 42) Source(4, 31) + SourceIndex(0) -12>Emitted(15, 43) Source(4, 32) + SourceIndex(0) -13>Emitted(15, 44) Source(4, 32) + SourceIndex(0) -14>Emitted(15, 60) Source(4, 32) + SourceIndex(0) -15>Emitted(15, 88) Source(4, 34) + SourceIndex(0) +1->Emitted(16, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(16, 10) Source(4, 17) + SourceIndex(0) +3 >Emitted(16, 14) Source(4, 17) + SourceIndex(0) +4 >Emitted(16, 19) Source(4, 17) + SourceIndex(0) +5 >Emitted(16, 28) Source(4, 17) + SourceIndex(0) +6 >Emitted(16, 29) Source(4, 18) + SourceIndex(0) +7 >Emitted(16, 32) Source(4, 21) + SourceIndex(0) +8 >Emitted(16, 34) Source(4, 23) + SourceIndex(0) +9 >Emitted(16, 37) Source(4, 26) + SourceIndex(0) +10>Emitted(16, 39) Source(4, 28) + SourceIndex(0) +11>Emitted(16, 42) Source(4, 31) + SourceIndex(0) +12>Emitted(16, 43) Source(4, 32) + SourceIndex(0) +13>Emitted(16, 44) Source(4, 32) + SourceIndex(0) +14>Emitted(16, 60) Source(4, 32) + SourceIndex(0) +15>Emitted(16, 88) Source(4, 34) + SourceIndex(0) --- ->>> foo().x = _b.value; +>>> foo().x = _c.value; 1 >^^^^^^^^ 2 > ^^^ 3 > ^^ @@ -123,12 +124,12 @@ sourceFile:ES5For-of34.ts 4 > . 5 > x 6 > -1 >Emitted(16, 9) Source(4, 6) + SourceIndex(0) -2 >Emitted(16, 12) Source(4, 9) + SourceIndex(0) -3 >Emitted(16, 14) Source(4, 11) + SourceIndex(0) -4 >Emitted(16, 15) Source(4, 12) + SourceIndex(0) -5 >Emitted(16, 16) Source(4, 13) + SourceIndex(0) -6 >Emitted(16, 27) Source(4, 13) + SourceIndex(0) +1 >Emitted(17, 9) Source(4, 6) + SourceIndex(0) +2 >Emitted(17, 12) Source(4, 9) + SourceIndex(0) +3 >Emitted(17, 14) Source(4, 11) + SourceIndex(0) +4 >Emitted(17, 15) Source(4, 12) + SourceIndex(0) +5 >Emitted(17, 16) Source(4, 13) + SourceIndex(0) +6 >Emitted(17, 27) Source(4, 13) + SourceIndex(0) --- >>> var p = foo().x; 1 >^^^^^^^^ @@ -150,29 +151,28 @@ sourceFile:ES5For-of34.ts 7 > . 8 > x 9 > ; -1 >Emitted(17, 9) Source(5, 5) + SourceIndex(0) -2 >Emitted(17, 13) Source(5, 9) + SourceIndex(0) -3 >Emitted(17, 14) Source(5, 10) + SourceIndex(0) -4 >Emitted(17, 17) Source(5, 13) + SourceIndex(0) -5 >Emitted(17, 20) Source(5, 16) + SourceIndex(0) -6 >Emitted(17, 22) Source(5, 18) + SourceIndex(0) -7 >Emitted(17, 23) Source(5, 19) + SourceIndex(0) -8 >Emitted(17, 24) Source(5, 20) + SourceIndex(0) -9 >Emitted(17, 25) Source(5, 21) + SourceIndex(0) +1 >Emitted(18, 9) Source(5, 5) + SourceIndex(0) +2 >Emitted(18, 13) Source(5, 9) + SourceIndex(0) +3 >Emitted(18, 14) Source(5, 10) + SourceIndex(0) +4 >Emitted(18, 17) Source(5, 13) + SourceIndex(0) +5 >Emitted(18, 20) Source(5, 16) + SourceIndex(0) +6 >Emitted(18, 22) Source(5, 18) + SourceIndex(0) +7 >Emitted(18, 23) Source(5, 19) + SourceIndex(0) +8 >Emitted(18, 24) Source(5, 20) + SourceIndex(0) +9 >Emitted(18, 25) Source(5, 21) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(18, 6) Source(6, 2) + SourceIndex(0) +1 >Emitted(19, 6) Source(6, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { >>> try { ->>> if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); +>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); >>> } >>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1, _c; >>>//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js b/tests/baselines/reference/ES5For-of35.js index 597296cacae..608ce967479 100644 --- a/tests/baselines/reference/ES5For-of35.js +++ b/tests/baselines/reference/ES5For-of35.js @@ -15,9 +15,10 @@ var __values = (this && this.__values) || function (o) { } }; }; +var e_1, _a; try { - for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { - var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e; + for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; a; b; } @@ -25,9 +26,8 @@ try { catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); + if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); } finally { if (e_1) throw e_1.error; } } -var e_1, _f; //# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js.map b/tests/baselines/reference/ES5For-of35.js.map index 73ecad3ea1f..ca243e5bde5 100644 --- a/tests/baselines/reference/ES5For-of35.js.map +++ b/tests/baselines/reference/ES5For-of35.js.map @@ -1,2 +1,2 @@ //// [ES5For-of35.js.map] -{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAAhC,IAAA,aAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAAhC,IAAA,aAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.sourcemap.txt b/tests/baselines/reference/ES5For-of35.sourcemap.txt index 1caba0a51e0..907fc3ce690 100644 --- a/tests/baselines/reference/ES5For-of35.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of35.sourcemap.txt @@ -18,8 +18,9 @@ sourceFile:ES5For-of35.ts >>> } >>> }; >>>}; +>>>var e_1, _a; >>>try { ->>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { +>>> for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { 1 >^^^^ 2 > ^^^^^ 3 > ^^^^ @@ -47,21 +48,21 @@ sourceFile:ES5For-of35.ts 11> 12> 13> ) -1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(12, 10) Source(1, 36) + SourceIndex(0) -3 >Emitted(12, 14) Source(1, 36) + SourceIndex(0) -4 >Emitted(12, 19) Source(1, 36) + SourceIndex(0) -5 >Emitted(12, 28) Source(1, 36) + SourceIndex(0) -6 >Emitted(12, 29) Source(1, 37) + SourceIndex(0) -7 >Emitted(12, 30) Source(1, 38) + SourceIndex(0) -8 >Emitted(12, 32) Source(1, 40) + SourceIndex(0) -9 >Emitted(12, 33) Source(1, 41) + SourceIndex(0) -10>Emitted(12, 34) Source(1, 42) + SourceIndex(0) -11>Emitted(12, 35) Source(1, 42) + SourceIndex(0) -12>Emitted(12, 51) Source(1, 42) + SourceIndex(0) -13>Emitted(12, 79) Source(1, 44) + SourceIndex(0) +1 >Emitted(13, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(13, 10) Source(1, 36) + SourceIndex(0) +3 >Emitted(13, 14) Source(1, 36) + SourceIndex(0) +4 >Emitted(13, 19) Source(1, 36) + SourceIndex(0) +5 >Emitted(13, 28) Source(1, 36) + SourceIndex(0) +6 >Emitted(13, 29) Source(1, 37) + SourceIndex(0) +7 >Emitted(13, 30) Source(1, 38) + SourceIndex(0) +8 >Emitted(13, 32) Source(1, 40) + SourceIndex(0) +9 >Emitted(13, 33) Source(1, 41) + SourceIndex(0) +10>Emitted(13, 34) Source(1, 42) + SourceIndex(0) +11>Emitted(13, 35) Source(1, 42) + SourceIndex(0) +12>Emitted(13, 51) Source(1, 42) + SourceIndex(0) +13>Emitted(13, 79) Source(1, 44) + SourceIndex(0) --- ->>> var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e; +>>> var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; 1->^^^^^^^^ 2 > ^^^^ 3 > ^^^^^^^^^^^^^ @@ -84,17 +85,17 @@ sourceFile:ES5For-of35.ts 9 > y: b = 1 10> 11> y: b = 1 -1->Emitted(13, 9) Source(1, 12) + SourceIndex(0) -2 >Emitted(13, 13) Source(1, 12) + SourceIndex(0) -3 >Emitted(13, 26) Source(1, 32) + SourceIndex(0) -4 >Emitted(13, 28) Source(1, 13) + SourceIndex(0) -5 >Emitted(13, 37) Source(1, 21) + SourceIndex(0) -6 >Emitted(13, 39) Source(1, 13) + SourceIndex(0) -7 >Emitted(13, 65) Source(1, 21) + SourceIndex(0) -8 >Emitted(13, 67) Source(1, 23) + SourceIndex(0) -9 >Emitted(13, 76) Source(1, 31) + SourceIndex(0) -10>Emitted(13, 78) Source(1, 23) + SourceIndex(0) -11>Emitted(13, 104) Source(1, 31) + SourceIndex(0) +1->Emitted(14, 9) Source(1, 12) + SourceIndex(0) +2 >Emitted(14, 13) Source(1, 12) + SourceIndex(0) +3 >Emitted(14, 26) Source(1, 32) + SourceIndex(0) +4 >Emitted(14, 28) Source(1, 13) + SourceIndex(0) +5 >Emitted(14, 37) Source(1, 21) + SourceIndex(0) +6 >Emitted(14, 39) Source(1, 13) + SourceIndex(0) +7 >Emitted(14, 65) Source(1, 21) + SourceIndex(0) +8 >Emitted(14, 67) Source(1, 23) + SourceIndex(0) +9 >Emitted(14, 76) Source(1, 31) + SourceIndex(0) +10>Emitted(14, 78) Source(1, 23) + SourceIndex(0) +11>Emitted(14, 104) Source(1, 31) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -105,9 +106,9 @@ sourceFile:ES5For-of35.ts > 2 > a 3 > ; -1 >Emitted(14, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(14, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(14, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(15, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(15, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(15, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -117,23 +118,22 @@ sourceFile:ES5For-of35.ts > 2 > b 3 > ; -1->Emitted(15, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(15, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(15, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(16, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(16, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(16, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(16, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(17, 6) Source(4, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { >>> try { ->>> if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); +>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); >>> } >>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1, _f; >>>//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js b/tests/baselines/reference/ES5For-of36.js index fca89ee922b..5d53b241466 100644 --- a/tests/baselines/reference/ES5For-of36.js +++ b/tests/baselines/reference/ES5For-of36.js @@ -31,9 +31,10 @@ var __read = (this && this.__read) || function (o, n) { } return ar; }; +var e_1, _a; try { - for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { - var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e; + for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; a; b; } @@ -41,9 +42,8 @@ try { catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); + if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); } finally { if (e_1) throw e_1.error; } } -var e_1, _f; //# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js.map b/tests/baselines/reference/ES5For-of36.js.map index cbf56b3686b..09fdb4fd820 100644 --- a/tests/baselines/reference/ES5For-of36.js.map +++ b/tests/baselines/reference/ES5For-of36.js.map @@ -1,2 +1,2 @@ //// [ES5For-of36.js.map] -{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAA,wBAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAA,wBAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.sourcemap.txt b/tests/baselines/reference/ES5For-of36.sourcemap.txt index 17249e4bb2b..c3ac87f51ca 100644 --- a/tests/baselines/reference/ES5For-of36.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of36.sourcemap.txt @@ -34,8 +34,9 @@ sourceFile:ES5For-of36.ts >>> } >>> return ar; >>>}; +>>>var e_1, _a; >>>try { ->>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { +>>> for (var _b = __values([2, 3]), _c = _b.next(); !_c.done; _c = _b.next()) { 1 >^^^^ 2 > ^^^^^ 3 > ^^^^ @@ -63,21 +64,21 @@ sourceFile:ES5For-of36.ts 11> 12> 13> ) -1 >Emitted(28, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(28, 10) Source(1, 28) + SourceIndex(0) -3 >Emitted(28, 14) Source(1, 28) + SourceIndex(0) -4 >Emitted(28, 19) Source(1, 28) + SourceIndex(0) -5 >Emitted(28, 28) Source(1, 28) + SourceIndex(0) -6 >Emitted(28, 29) Source(1, 29) + SourceIndex(0) -7 >Emitted(28, 30) Source(1, 30) + SourceIndex(0) -8 >Emitted(28, 32) Source(1, 32) + SourceIndex(0) -9 >Emitted(28, 33) Source(1, 33) + SourceIndex(0) -10>Emitted(28, 34) Source(1, 34) + SourceIndex(0) -11>Emitted(28, 35) Source(1, 34) + SourceIndex(0) -12>Emitted(28, 51) Source(1, 34) + SourceIndex(0) -13>Emitted(28, 79) Source(1, 36) + SourceIndex(0) +1 >Emitted(29, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(29, 10) Source(1, 28) + SourceIndex(0) +3 >Emitted(29, 14) Source(1, 28) + SourceIndex(0) +4 >Emitted(29, 19) Source(1, 28) + SourceIndex(0) +5 >Emitted(29, 28) Source(1, 28) + SourceIndex(0) +6 >Emitted(29, 29) Source(1, 29) + SourceIndex(0) +7 >Emitted(29, 30) Source(1, 30) + SourceIndex(0) +8 >Emitted(29, 32) Source(1, 32) + SourceIndex(0) +9 >Emitted(29, 33) Source(1, 33) + SourceIndex(0) +10>Emitted(29, 34) Source(1, 34) + SourceIndex(0) +11>Emitted(29, 35) Source(1, 34) + SourceIndex(0) +12>Emitted(29, 51) Source(1, 34) + SourceIndex(0) +13>Emitted(29, 79) Source(1, 36) + SourceIndex(0) --- ->>> var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e; +>>> var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; 1->^^^^^^^^ 2 > ^^^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,17 +101,17 @@ sourceFile:ES5For-of36.ts 9 > b = 1 10> 11> b = 1 -1->Emitted(29, 9) Source(1, 10) + SourceIndex(0) -2 >Emitted(29, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(29, 37) Source(1, 24) + SourceIndex(0) -4 >Emitted(29, 39) Source(1, 11) + SourceIndex(0) -5 >Emitted(29, 49) Source(1, 16) + SourceIndex(0) -6 >Emitted(29, 51) Source(1, 11) + SourceIndex(0) -7 >Emitted(29, 77) Source(1, 16) + SourceIndex(0) -8 >Emitted(29, 79) Source(1, 18) + SourceIndex(0) -9 >Emitted(29, 89) Source(1, 23) + SourceIndex(0) -10>Emitted(29, 91) Source(1, 18) + SourceIndex(0) -11>Emitted(29, 117) Source(1, 23) + SourceIndex(0) +1->Emitted(30, 9) Source(1, 10) + SourceIndex(0) +2 >Emitted(30, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(30, 37) Source(1, 24) + SourceIndex(0) +4 >Emitted(30, 39) Source(1, 11) + SourceIndex(0) +5 >Emitted(30, 49) Source(1, 16) + SourceIndex(0) +6 >Emitted(30, 51) Source(1, 11) + SourceIndex(0) +7 >Emitted(30, 77) Source(1, 16) + SourceIndex(0) +8 >Emitted(30, 79) Source(1, 18) + SourceIndex(0) +9 >Emitted(30, 89) Source(1, 23) + SourceIndex(0) +10>Emitted(30, 91) Source(1, 18) + SourceIndex(0) +11>Emitted(30, 117) Source(1, 23) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -121,9 +122,9 @@ sourceFile:ES5For-of36.ts > 2 > a 3 > ; -1 >Emitted(30, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(30, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(30, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(31, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(31, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(31, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -133,23 +134,22 @@ sourceFile:ES5For-of36.ts > 2 > b 3 > ; -1->Emitted(31, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(31, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(31, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(32, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(32, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(32, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(32, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(33, 6) Source(4, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { >>> try { ->>> if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); +>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); >>> } >>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1, _f; >>>//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index ab3f420c95c..4300218c626 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -11,9 +11,9 @@ var obj = { obj[Symbol.foo]; //// [ES5SymbolProperty1.js] +var _a; var Symbol; var obj = (_a = {}, _a[Symbol.foo] = 0, _a); obj[Symbol.foo]; -var _a; diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 64f6bff50c0..2b2912ffcc7 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,5 +2,5 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = (_a = {}, _a[yield] = foo, _a); var _a; +var v = (_a = {}, _a[yield] = foo, _a); diff --git a/tests/baselines/reference/SystemModuleForStatementNoInitializer.js b/tests/baselines/reference/SystemModuleForStatementNoInitializer.js index 2ab13a47c89..059e6175b30 100644 --- a/tests/baselines/reference/SystemModuleForStatementNoInitializer.js +++ b/tests/baselines/reference/SystemModuleForStatementNoInitializer.js @@ -19,9 +19,9 @@ for (; ;) { //// [SystemModuleForStatementNoInitializer.js] System.register([], function (exports_1, context_1) { + var i, limit; "use strict"; var __moduleName = context_1 && context_1.id; - var i, limit; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/aliasInaccessibleModule.errors.txt b/tests/baselines/reference/aliasInaccessibleModule.errors.txt deleted file mode 100644 index 3a9c64e50ab..00000000000 --- a/tests/baselines/reference/aliasInaccessibleModule.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/compiler/aliasInaccessibleModule.ts(4,23): error TS4000: Import declaration 'X' is using private name 'N'. - - -==== tests/cases/compiler/aliasInaccessibleModule.ts (1 errors) ==== - module M { - module N { - } - export import X = N; - ~ -!!! error TS4000: Import declaration 'X' is using private name 'N'. - } \ No newline at end of file diff --git a/tests/baselines/reference/aliasInaccessibleModule.js b/tests/baselines/reference/aliasInaccessibleModule.js index a0ecf3361fc..66a59a9f0ee 100644 --- a/tests/baselines/reference/aliasInaccessibleModule.js +++ b/tests/baselines/reference/aliasInaccessibleModule.js @@ -9,3 +9,11 @@ module M { var M; (function (M) { })(M || (M = {})); + + +//// [aliasInaccessibleModule.d.ts] +declare module M { + module N { + } + export import X = N; +} diff --git a/tests/baselines/reference/aliasInaccessibleModule2.errors.txt b/tests/baselines/reference/aliasInaccessibleModule2.errors.txt deleted file mode 100644 index 03a37147aba..00000000000 --- a/tests/baselines/reference/aliasInaccessibleModule2.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/compiler/aliasInaccessibleModule2.ts(7,16): error TS4000: Import declaration 'R' is using private name 'N'. - - -==== tests/cases/compiler/aliasInaccessibleModule2.ts (1 errors) ==== - module M { - module N { - class C { - } - - } - import R = N; - ~ -!!! error TS4000: Import declaration 'R' is using private name 'N'. - export import X = R; - } \ No newline at end of file diff --git a/tests/baselines/reference/aliasInaccessibleModule2.js b/tests/baselines/reference/aliasInaccessibleModule2.js index be208c07ca2..324581ce622 100644 --- a/tests/baselines/reference/aliasInaccessibleModule2.js +++ b/tests/baselines/reference/aliasInaccessibleModule2.js @@ -23,3 +23,12 @@ var M; var R = N; M.X = R; })(M || (M = {})); + + +//// [aliasInaccessibleModule2.d.ts] +declare module M { + module N { + } + import R = N; + export import X = R; +} diff --git a/tests/baselines/reference/aliasesInSystemModule1.js b/tests/baselines/reference/aliasesInSystemModule1.js index f940dd04597..340a8f53e3c 100644 --- a/tests/baselines/reference/aliasesInSystemModule1.js +++ b/tests/baselines/reference/aliasesInSystemModule1.js @@ -17,9 +17,9 @@ module M { //// [aliasesInSystemModule1.js] System.register(["foo"], function (exports_1, context_1) { + var alias, cls, cls2, x, y, z, M; "use strict"; var __moduleName = context_1 && context_1.id; - var alias, cls, cls2, x, y, z, M; return { setters: [ function (alias_1) { diff --git a/tests/baselines/reference/aliasesInSystemModule2.js b/tests/baselines/reference/aliasesInSystemModule2.js index 5ef48a52cde..88875297b2f 100644 --- a/tests/baselines/reference/aliasesInSystemModule2.js +++ b/tests/baselines/reference/aliasesInSystemModule2.js @@ -16,9 +16,9 @@ module M { //// [aliasesInSystemModule2.js] System.register(["foo"], function (exports_1, context_1) { + var foo_1, cls, cls2, x, y, z, M; "use strict"; var __moduleName = context_1 && context_1.id; - var foo_1, cls, cls2, x, y, z, M; return { setters: [ function (foo_1_1) { diff --git a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types index 396cdd4445e..e1b331019bf 100644 --- a/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types +++ b/tests/baselines/reference/allowJscheckJsTypeParameterNoCrash.types @@ -4,12 +4,12 @@ interface ComponentOptions { >V : V watch: Record>; ->watch : Record void> +>watch : Record> >Record : Record ->WatchHandler : (val: T) => void +>WatchHandler : WatchHandler } type WatchHandler = (val: T) => void; ->WatchHandler : (val: T) => void +>WatchHandler : WatchHandler >T : T >val : T >T : T diff --git a/tests/baselines/reference/allowSyntheticDefaultImports2.js b/tests/baselines/reference/allowSyntheticDefaultImports2.js index c1e43a4fc81..2ab6ae38c13 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports2.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports2.js @@ -11,9 +11,9 @@ export class Foo { //// [a.js] System.register(["./b"], function (exports_1, context_1) { + var b_1, x; "use strict"; var __moduleName = context_1 && context_1.id; - var b_1, x; return { setters: [ function (b_1_1) { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports3.js b/tests/baselines/reference/allowSyntheticDefaultImports3.js index 45fb821a4e2..0e8207eaf26 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports3.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports3.js @@ -12,9 +12,9 @@ export class Foo { //// [b.js] System.register([], function (exports_1, context_1) { + var Foo; "use strict"; var __moduleName = context_1 && context_1.id; - var Foo; return { setters: [], execute: function () { @@ -29,9 +29,9 @@ System.register([], function (exports_1, context_1) { }); //// [a.js] System.register(["./b"], function (exports_1, context_1) { + var b_1, x; "use strict"; var __moduleName = context_1 && context_1.id; - var b_1, x; return { setters: [ function (b_1_1) { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports5.js b/tests/baselines/reference/allowSyntheticDefaultImports5.js index 765d1140864..0ca15c82cde 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports5.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports5.js @@ -13,9 +13,9 @@ export var x = new Foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { + var b_1, x; "use strict"; var __moduleName = context_1 && context_1.id; - var b_1, x; return { setters: [ function (b_1_1) { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports6.js b/tests/baselines/reference/allowSyntheticDefaultImports6.js index 9ae7acae919..1d19b3fb46c 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports6.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports6.js @@ -13,9 +13,9 @@ export var x = new Foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { + var b_1, x; "use strict"; var __moduleName = context_1 && context_1.id; - var b_1, x; return { setters: [ function (b_1_1) { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports7.js b/tests/baselines/reference/allowSyntheticDefaultImports7.js index 6d0ea5b3be0..6a3d45ba59e 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports7.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports7.js @@ -12,9 +12,9 @@ Foo.foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { + var b_1; "use strict"; var __moduleName = context_1 && context_1.id; - var b_1; return { setters: [ function (b_1_1) { diff --git a/tests/baselines/reference/allowSyntheticDefaultImports8.js b/tests/baselines/reference/allowSyntheticDefaultImports8.js index 5a77e51e6a2..dff56737805 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports8.js +++ b/tests/baselines/reference/allowSyntheticDefaultImports8.js @@ -12,9 +12,9 @@ Foo.foo(); //// [a.js] System.register(["./b"], function (exports_1, context_1) { + var b_1; "use strict"; var __moduleName = context_1 && context_1.id; - var b_1; return { setters: [ function (b_1_1) { diff --git a/tests/baselines/reference/anonymousDefaultExportsSystem.js b/tests/baselines/reference/anonymousDefaultExportsSystem.js index c1d2cf522fb..bc3d35cda90 100644 --- a/tests/baselines/reference/anonymousDefaultExportsSystem.js +++ b/tests/baselines/reference/anonymousDefaultExportsSystem.js @@ -8,9 +8,9 @@ export default function() {} //// [a.js] System.register([], function (exports_1, context_1) { + var default_1; "use strict"; var __moduleName = context_1 && context_1.id; - var default_1; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 6865d40fd81..c698c582ac3 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1884,6 +1884,7 @@ declare namespace ts { None = 0, NoTruncation = 1, WriteArrayAsGenericType = 2, + GenerateNamesForShadowedTypeParams = 4, UseStructuralFallback = 8, WriteTypeArgumentsOfSignature = 32, UseFullyQualifiedType = 64, @@ -3485,6 +3486,8 @@ declare namespace ts { function createLiteral(value: boolean): BooleanLiteral; function createLiteral(value: string | number | boolean): PrimaryExpression; function createNumericLiteral(value: string): NumericLiteral; + function createStringLiteral(text: string): StringLiteral; + function createRegularExpressionLiteral(text: string): RegularExpressionLiteral; function createIdentifier(text: string): Identifier; function updateIdentifier(node: Identifier): Identifier; /** Create a unique temporary variable. */ @@ -4327,7 +4330,7 @@ declare namespace ts { getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; getFullStart(): number; getEnd(): number; - getWidth(sourceFile?: SourceFile): number; + getWidth(sourceFile?: SourceFileLike): number; getFullWidth(): number; getLeadingTriviaWidth(sourceFile?: SourceFile): number; getFullText(sourceFile?: SourceFile): string; @@ -4470,6 +4473,7 @@ declare namespace ts { readonly includeCompletionsForModuleExports?: boolean; readonly includeCompletionsWithInsertText?: boolean; readonly importModuleSpecifierPreference?: "relative" | "non-relative"; + readonly allowTextChangesInNewFiles?: boolean; } interface LanguageService { cleanupSemanticCache(): void; @@ -8045,6 +8049,7 @@ declare namespace ts.server { readonly ts: number; readonly tsx: number; readonly dts: number; + readonly deferred: number; } interface OpenFileInfo { readonly checkJs: boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3e428b01dad..1b15087f0d0 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1884,6 +1884,7 @@ declare namespace ts { None = 0, NoTruncation = 1, WriteArrayAsGenericType = 2, + GenerateNamesForShadowedTypeParams = 4, UseStructuralFallback = 8, WriteTypeArgumentsOfSignature = 32, UseFullyQualifiedType = 64, @@ -3485,6 +3486,8 @@ declare namespace ts { function createLiteral(value: boolean): BooleanLiteral; function createLiteral(value: string | number | boolean): PrimaryExpression; function createNumericLiteral(value: string): NumericLiteral; + function createStringLiteral(text: string): StringLiteral; + function createRegularExpressionLiteral(text: string): RegularExpressionLiteral; function createIdentifier(text: string): Identifier; function updateIdentifier(node: Identifier): Identifier; /** Create a unique temporary variable. */ @@ -4327,7 +4330,7 @@ declare namespace ts { getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; getFullStart(): number; getEnd(): number; - getWidth(sourceFile?: SourceFile): number; + getWidth(sourceFile?: SourceFileLike): number; getFullWidth(): number; getLeadingTriviaWidth(sourceFile?: SourceFile): number; getFullText(sourceFile?: SourceFile): string; @@ -4470,6 +4473,7 @@ declare namespace ts { readonly includeCompletionsForModuleExports?: boolean; readonly includeCompletionsWithInsertText?: boolean; readonly importModuleSpecifierPreference?: "relative" | "non-relative"; + readonly allowTextChangesInNewFiles?: boolean; } interface LanguageService { cleanupSemanticCache(): void; diff --git a/tests/baselines/reference/assignmentTypeNarrowing.js b/tests/baselines/reference/assignmentTypeNarrowing.js index 92fd49d9941..4d6b911b88b 100644 --- a/tests/baselines/reference/assignmentTypeNarrowing.js +++ b/tests/baselines/reference/assignmentTypeNarrowing.js @@ -30,6 +30,7 @@ for (x of a) { //// [assignmentTypeNarrowing.js] +var _a, _b, _c; var x; x = ""; x; // string @@ -50,4 +51,3 @@ for (var _i = 0, a_1 = a; _i < a_1.length; _i++) { x = a_1[_i]; x; // string } -var _a, _b, _c; diff --git a/tests/baselines/reference/asyncArrowFunction7_es5.js b/tests/baselines/reference/asyncArrowFunction7_es5.js index b93966443ab..6988d1d019a 100644 --- a/tests/baselines/reference/asyncArrowFunction7_es5.js +++ b/tests/baselines/reference/asyncArrowFunction7_es5.js @@ -8,8 +8,8 @@ var bar = async (): Promise => { //// [asyncArrowFunction7_es5.js] var _this = this; var bar = function () { return __awaiter(_this, void 0, void 0, function () { - var _this = this; var foo; + var _this = this; return __generator(this, function (_a) { foo = function (a) { if (a === void 0) { a = yield ; } diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.js b/tests/baselines/reference/asyncArrowFunction8_es5.js index 26153a59436..7e9e5a492be 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es5.js +++ b/tests/baselines/reference/asyncArrowFunction8_es5.js @@ -6,7 +6,7 @@ var foo = async (): Promise => { //// [asyncArrowFunction8_es5.js] var _this = this; var foo = function () { return __awaiter(_this, void 0, void 0, function () { - var v, _a; + var _a, v; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/asyncAwaitNestedClasses_es5.js b/tests/baselines/reference/asyncAwaitNestedClasses_es5.js index ff806b76ff1..f72dda7bec2 100644 --- a/tests/baselines/reference/asyncAwaitNestedClasses_es5.js +++ b/tests/baselines/reference/asyncAwaitNestedClasses_es5.js @@ -20,6 +20,7 @@ A.B.C.func(); var A = /** @class */ (function () { function A() { } + var _a; A.B = (_a = /** @class */ (function () { function B() { } @@ -47,6 +48,5 @@ var A = /** @class */ (function () { }()), _a); return A; - var _a; }()); A.B.C.func(); diff --git a/tests/baselines/reference/asyncFunctionDeclaration8_es5.js b/tests/baselines/reference/asyncFunctionDeclaration8_es5.js index 3e518481178..994ebfe6c7c 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration8_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration8_es5.js @@ -2,5 +2,5 @@ var v = { [await]: foo } //// [asyncFunctionDeclaration8_es5.js] -var v = (_a = {}, _a[await] = foo, _a); var _a; +var v = (_a = {}, _a[await] = foo, _a); diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js index e35ec29595b..2fd29408422 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js @@ -6,7 +6,7 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es5.js] function foo() { return __awaiter(this, void 0, void 0, function () { - var v, _a; + var _a, v; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/asyncFunctionTempVariableScoping.js b/tests/baselines/reference/asyncFunctionTempVariableScoping.js index b4f8caa6508..fb4137e1671 100644 --- a/tests/baselines/reference/asyncFunctionTempVariableScoping.js +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping.js @@ -51,8 +51,8 @@ var __rest = (this && this.__rest) || function (s, e) { }; var _this = this; (function (_a) { return __awaiter(_this, void 0, void 0, function () { - var foo = _a.foo, bar = _a.bar, rest = __rest(_a, ["foo", "bar"]); var _b; + var foo = _a.foo, bar = _a.bar, rest = __rest(_a, ["foo", "bar"]); return __generator(this, function (_c) { switch (_c.label) { case 0: diff --git a/tests/baselines/reference/asyncWithVarShadowing_es6.js b/tests/baselines/reference/asyncWithVarShadowing_es6.js index 392bed9d294..ecdffcd25a5 100644 --- a/tests/baselines/reference/asyncWithVarShadowing_es6.js +++ b/tests/baselines/reference/asyncWithVarShadowing_es6.js @@ -224,14 +224,14 @@ async function fn40(x) { //// [asyncWithVarShadowing_es6.js] function fn1(x) { + var x; return __awaiter(this, void 0, void 0, function* () { }); - var x; } function fn2(x) { + var x, z; return __awaiter(this, void 0, void 0, function* () { }); - var x, z; } function fn3(x) { return __awaiter(this, void 0, void 0, function* () { @@ -239,139 +239,139 @@ function fn3(x) { }); } function fn4(x) { + var x; return __awaiter(this, void 0, void 0, function* () { x = y; }); - var x; } function fn5(x) { + var x; return __awaiter(this, void 0, void 0, function* () { ({ x } = y); }); - var x; } function fn6(x) { + var x, z; return __awaiter(this, void 0, void 0, function* () { ({ x, z } = y); }); - var x, z; } function fn7(x) { + var x; return __awaiter(this, void 0, void 0, function* () { ({ x = y } = y); }); - var x; } function fn8(x) { + var x; return __awaiter(this, void 0, void 0, function* () { ({ z: x } = y); }); - var x; } function fn9(x) { + var x; return __awaiter(this, void 0, void 0, function* () { ({ z: { x } } = y); }); - var x; } function fn10(x) { + var x; return __awaiter(this, void 0, void 0, function* () { ({ z: { x } = y } = y); }); - var x; } function fn11(x) { + var x; return __awaiter(this, void 0, void 0, function* () { x = __rest(y, []); }); - var x; } function fn12(x) { + var x; return __awaiter(this, void 0, void 0, function* () { [x] = y; }); - var x; } function fn13(x) { + var x; return __awaiter(this, void 0, void 0, function* () { [x = y] = y; }); - var x; } function fn14(x) { + var x; return __awaiter(this, void 0, void 0, function* () { [, x] = y; }); - var x; } function fn15(x) { + var x; return __awaiter(this, void 0, void 0, function* () { [...x] = y; }); - var x; } function fn16(x) { + var x; return __awaiter(this, void 0, void 0, function* () { [[x]] = y; }); - var x; } function fn17(x) { + var x; return __awaiter(this, void 0, void 0, function* () { [[x] = y] = y; }); - var x; } function fn18({ x }) { + var x; return __awaiter(this, void 0, void 0, function* () { }); - var x; } function fn19([x]) { + var x; return __awaiter(this, void 0, void 0, function* () { }); - var x; } function fn20(x) { + var x; return __awaiter(this, void 0, void 0, function* () { { } }); - var x; } function fn21(x) { + var x; return __awaiter(this, void 0, void 0, function* () { if (y) { } }); - var x; } function fn22(x) { + var x; return __awaiter(this, void 0, void 0, function* () { if (y) { } else { } }); - var x; } function fn23(x) { + var x; return __awaiter(this, void 0, void 0, function* () { try { } catch (e) { } }); - var x; } function fn24(x) { + var x; return __awaiter(this, void 0, void 0, function* () { try { } catch (e) { } }); - var x; } function fn25(x) { return __awaiter(this, void 0, void 0, function* () { @@ -392,106 +392,106 @@ function fn26(x) { }); } function fn27(x) { + var x; return __awaiter(this, void 0, void 0, function* () { try { } finally { } }); - var x; } function fn28(x) { + var x; return __awaiter(this, void 0, void 0, function* () { while (y) { } }); - var x; } function fn29(x) { + var x; return __awaiter(this, void 0, void 0, function* () { do { } while (y); }); - var x; } function fn30(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for (x = y;;) { } }); - var x; } function fn31(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for ({ x } = y;;) { } }); - var x; } function fn32(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for (;;) { } }); - var x; } function fn33(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for (x in y) { } }); - var x; } function fn34(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for (var z in y) { } }); - var x; } function fn35(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for (x of y) { } }); - var x; } function fn36(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for ({ x } of y) { } }); - var x; } function fn37(x) { + var x; return __awaiter(this, void 0, void 0, function* () { for (var z of y) { } }); - var x; } function fn38(x) { + var x; return __awaiter(this, void 0, void 0, function* () { switch (y) { case y: } }); - var x; } function fn39(x) { + var x; return __awaiter(this, void 0, void 0, function* () { foo: { break foo; } }); - var x; } function fn40(x) { + var x; return __awaiter(this, void 0, void 0, function* () { try { } catch (_a) { } }); - var x; } diff --git a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js index cde242c14ea..e8a8e02a6a1 100644 --- a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js +++ b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js @@ -4,8 +4,8 @@ export let [,,[,[],,[],]] = undefined as any; //// [bindingPatternOmittedExpressionNesting.js] "use strict"; exports.__esModule = true; -exports._e = (_a = undefined, _b = _a[2], _c = _b[1], _d = _b[3]); var _a, _b, _c, _d; +exports._e = (_a = undefined, _b = _a[2], _c = _b[1], _d = _b[3]); //// [bindingPatternOmittedExpressionNesting.d.ts] diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js index be2bcd0bb0c..5f3eed666ab 100644 --- a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js @@ -45,7 +45,7 @@ var __values = (this && this.__values) || function (o) { }; }; function a() { - var _loop_1, _a, _b, i, e_1_1, e_1, _c; + var e_1, _a, _loop_1, _b, _c, i, e_1_1; return __generator(this, function (_d) { switch (_d.label) { case 0: @@ -64,17 +64,17 @@ function a() { _d.label = 1; case 1: _d.trys.push([1, 6, 7, 8]); - _a = __values([1, 2, 3]), _b = _a.next(); + _b = __values([1, 2, 3]), _c = _b.next(); _d.label = 2; case 2: - if (!!_b.done) return [3 /*break*/, 5]; - i = _b.value; + if (!!_c.done) return [3 /*break*/, 5]; + i = _c.value; return [5 /*yield**/, _loop_1(i)]; case 3: _d.sent(); _d.label = 4; case 4: - _b = _a.next(); + _c = _b.next(); return [3 /*break*/, 2]; case 5: return [3 /*break*/, 8]; case 6: @@ -83,7 +83,7 @@ function a() { return [3 /*break*/, 8]; case 7: try { - if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js index b0e58c59f5f..b14ea2a3069 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.js @@ -163,6 +163,7 @@ function foo8() { var x; } function foo9() { + var _a; var y = (_a = /** @class */ (function () { function class_3() { } @@ -171,7 +172,6 @@ function foo9() { _a.a = x, _a); var x; - var _a; } function foo10() { var A = /** @class */ (function () { @@ -184,6 +184,7 @@ function foo10() { } function foo11() { function f() { + var _a; var y = (_a = /** @class */ (function () { function class_4() { } @@ -191,7 +192,6 @@ function foo11() { }()), _a.a = x, _a); - var _a; } var x; } diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 2059c7ab090..1b78ebeb8ec 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -69,6 +69,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); +var _a, _b, _c, _d, _e, _f, _g; function foo(x, y) { var z = []; for (var _i = 2; _i < arguments.length; _i++) { @@ -128,4 +129,3 @@ var D = /** @class */ (function (_super) { }; return D; }(C)); -var _a, _b, _c, _d, _e, _f, _g; diff --git a/tests/baselines/reference/capturedLetConstInLoop12.js b/tests/baselines/reference/capturedLetConstInLoop12.js index 1bb691bb72a..3625556c89a 100644 --- a/tests/baselines/reference/capturedLetConstInLoop12.js +++ b/tests/baselines/reference/capturedLetConstInLoop12.js @@ -20,8 +20,8 @@ "use strict"; var _loop_1 = function (i) { (function () { - return _a = [i + 1], i = _a[0], _a; var _a; + return _a = [i + 1], i = _a[0], _a; })(); out_i_1 = i; }; @@ -35,8 +35,8 @@ "use strict"; var _loop_2 = function (i) { (function () { - return (_a = { a: i + 1 }, i = _a.a, _a); var _a; + return (_a = { a: i + 1 }, i = _a.a, _a); })(); out_i_2 = i; }; diff --git a/tests/baselines/reference/capturedLetConstInLoop13.js b/tests/baselines/reference/capturedLetConstInLoop13.js index 03c1ebef8a8..628faa10485 100644 --- a/tests/baselines/reference/capturedLetConstInLoop13.js +++ b/tests/baselines/reference/capturedLetConstInLoop13.js @@ -34,10 +34,10 @@ var Main = /** @class */ (function () { names[_i] = arguments[_i]; } var _loop_1 = function (name_1) { + var _a; this_1.bar((_a = {}, _a[name_1 + ".a"] = function () { _this.foo(name_1); }, _a)); - var _a; }; var this_1 = this; for (var _a = 0, names_1 = names; _a < names_1.length; _a++) { diff --git a/tests/baselines/reference/capturedLetConstInLoop4.js b/tests/baselines/reference/capturedLetConstInLoop4.js index bc259a73a88..874a1d4130e 100644 --- a/tests/baselines/reference/capturedLetConstInLoop4.js +++ b/tests/baselines/reference/capturedLetConstInLoop4.js @@ -144,6 +144,7 @@ for (const y = 0; y < 1;) { //// [capturedLetConstInLoop4.js] System.register([], function (exports_1, context_1) { + var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c; "use strict"; var __moduleName = context_1 && context_1.id; //======let @@ -156,7 +157,6 @@ System.register([], function (exports_1, context_1) { return v0_c + v00_c + v1_c + v2_c + v3_c + v4_c + v5_c + v6_c + v7_c + v8_c; } exports_1("exportedFoo2", exportedFoo2); - var v0, v00, v1, v2, v3, v4, v5, v6, v7, v8, v0_c, v00_c, v1_c, v2_c, v3_c, v4_c, v5_c, v6_c, v7_c, v8_c; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index 3b162215918..0795d509f9b 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -178,15 +178,16 @@ for (var x = 0; x < 1; ++x) { } function foo() { var _loop_3 = function (a) { + var _a; if (a === 1) { return "break"; } if (a === 2) { return "break-l0"; } - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var b = _a[_i]; - _d = [{ x: 1, y: 2 }][0], x = _d.x, z = _d.y; + for (var _i = 0, _b = []; _i < _b.length; _i++) { + var b = _b[_i]; + _a = [{ x: 1, y: 2 }][0], x = _a.x, z = _a.y; if (b === 1) { break; } @@ -199,6 +200,7 @@ function foo() { return { value: 50 }; } var _loop_4 = function (b) { + var _a; _a = [{ x1: 1, y: arguments_1.length }][0], x1 = _a.x1, z1 = _a.y; if (b === 1) { return "break"; @@ -208,10 +210,9 @@ function foo() { } (function () { return b; }); return { value: 100 }; - var _a; }; - for (var _b = 0, _c = []; _b < _c.length; _b++) { - var b = _c[_b]; + for (var _c = 0, _d = []; _c < _d.length; _c++) { + var b = _d[_c]; var state_2 = _loop_4(b); if (typeof state_2 === "object") return state_2; @@ -222,7 +223,6 @@ function foo() { } } (function () { return a; }); - var _d; }; var arguments_1 = arguments, x, z, x1, z1; l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { diff --git a/tests/baselines/reference/capturedParametersInInitializers2.js b/tests/baselines/reference/capturedParametersInInitializers2.js index 481bed687bb..5b5f06fc5b0 100644 --- a/tests/baselines/reference/capturedParametersInInitializers2.js +++ b/tests/baselines/reference/capturedParametersInInitializers2.js @@ -15,8 +15,8 @@ function foo(y, x) { _a.c = x, _a); } if (x === void 0) { x = 1; } - y.c; var _a; + y.c; } function foo2(y, x) { if (y === void 0) { y = (_b = /** @class */ (function () { diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js index 26f19815855..90f83b4ff99 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js @@ -25,6 +25,7 @@ obj.bar1 = "42"; obj.arrowFunc(0); //// [0.js] +var _a; // @ts-check var lol = "hello Lol"; var obj = (_a = { @@ -50,4 +51,3 @@ obj.bar = undefined; var k = obj.method1(0); obj.bar1 = "42"; obj.arrowFunc(0); -var _a; diff --git a/tests/baselines/reference/classBlockScoping.js b/tests/baselines/reference/classBlockScoping.js index f5a642ed8fc..ee3d9163b5e 100644 --- a/tests/baselines/reference/classBlockScoping.js +++ b/tests/baselines/reference/classBlockScoping.js @@ -35,6 +35,7 @@ function f(b: boolean) { //// [classBlockScoping.js] function f(b) { + var _a; var Foo; if (b) { Foo = (_a = /** @class */ (function () { @@ -67,5 +68,4 @@ function f(b) { }()); new Foo_1(); } - var _a; } diff --git a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js index 2b59b358ffe..5367ef781a5 100644 --- a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js +++ b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.js @@ -18,11 +18,11 @@ var A = /** @class */ (function () { A[(_a = A.p1, A.p2)] = function () { return 0; }; ; A.prototype[A.p1] = function () { }; + var _a, _b; _b = A.p2; A.p1 = Symbol(); A.p2 = Symbol(); // All of the below should be out of scope or TDZ - `A` has not finished being constructed as they are executed A[_a] = 0; return A; - var _a, _b; }()); diff --git a/tests/baselines/reference/classExpressionWithStaticProperties1.js b/tests/baselines/reference/classExpressionWithStaticProperties1.js index 03b67b32886..6d6795bc9f9 100644 --- a/tests/baselines/reference/classExpressionWithStaticProperties1.js +++ b/tests/baselines/reference/classExpressionWithStaticProperties1.js @@ -6,6 +6,7 @@ var v = class C { }; //// [classExpressionWithStaticProperties1.js] +var _a; var v = (_a = /** @class */ (function () { function C() { } @@ -15,4 +16,3 @@ var v = (_a = /** @class */ (function () { _a.b = 2, _a.c = _a.a + _a.b, _a); -var _a; diff --git a/tests/baselines/reference/classExpressionWithStaticProperties2.js b/tests/baselines/reference/classExpressionWithStaticProperties2.js index f142f10cc33..355a6e16ee0 100644 --- a/tests/baselines/reference/classExpressionWithStaticProperties2.js +++ b/tests/baselines/reference/classExpressionWithStaticProperties2.js @@ -9,6 +9,7 @@ var v = class C { }; //// [classExpressionWithStaticProperties2.js] +var _a; var v = (_a = /** @class */ (function () { function C() { } @@ -20,4 +21,3 @@ var v = (_a = /** @class */ (function () { }, _a.d = _a.c.x + " world", _a); -var _a; diff --git a/tests/baselines/reference/classExpressionWithStaticProperties3.js b/tests/baselines/reference/classExpressionWithStaticProperties3.js index 4a7ff96751c..d71f02f22cb 100644 --- a/tests/baselines/reference/classExpressionWithStaticProperties3.js +++ b/tests/baselines/reference/classExpressionWithStaticProperties3.js @@ -10,6 +10,7 @@ for (let i = 0; i < 3; i++) { arr.forEach(C => console.log(C.y())); //// [classExpressionWithStaticProperties3.js] +var _a; var arr = []; var _loop_1 = function (i) { arr.push((_a = /** @class */ (function () { @@ -25,4 +26,3 @@ for (var i = 0; i < 3; i++) { _loop_1(i); } arr.forEach(function (C) { return console.log(C.y()); }); -var _a; diff --git a/tests/baselines/reference/classExpressionWithStaticPropertiesES61.js b/tests/baselines/reference/classExpressionWithStaticPropertiesES61.js index d3a210df7e2..e860c5be142 100644 --- a/tests/baselines/reference/classExpressionWithStaticPropertiesES61.js +++ b/tests/baselines/reference/classExpressionWithStaticPropertiesES61.js @@ -6,10 +6,10 @@ var v = class C { }; //// [classExpressionWithStaticPropertiesES61.js] +var _a; var v = (_a = class C { }, _a.a = 1, _a.b = 2, _a.c = _a.a + 3, _a); -var _a; diff --git a/tests/baselines/reference/classExpressionWithStaticPropertiesES62.js b/tests/baselines/reference/classExpressionWithStaticPropertiesES62.js index d0f56131d54..5b5524b8856 100644 --- a/tests/baselines/reference/classExpressionWithStaticPropertiesES62.js +++ b/tests/baselines/reference/classExpressionWithStaticPropertiesES62.js @@ -9,6 +9,7 @@ var v = class C { }; //// [classExpressionWithStaticPropertiesES62.js] +var _a; var v = (_a = class C { }, _a.a = 1, @@ -17,4 +18,3 @@ var v = (_a = class C { }, _a.d = _a.c.x + " world", _a); -var _a; diff --git a/tests/baselines/reference/classExpressionWithStaticPropertiesES63.js b/tests/baselines/reference/classExpressionWithStaticPropertiesES63.js index 0ac97e7a755..8ff0f242f19 100644 --- a/tests/baselines/reference/classExpressionWithStaticPropertiesES63.js +++ b/tests/baselines/reference/classExpressionWithStaticPropertiesES63.js @@ -10,6 +10,7 @@ for (let i = 0; i < 3; i++) { arr.forEach(C => console.log(C.y())); //// [classExpressionWithStaticPropertiesES63.js] +var _a; const arr = []; for (let i = 0; i < 3; i++) { arr.push((_a = class C { @@ -19,4 +20,3 @@ for (let i = 0; i < 3; i++) { _a)); } arr.forEach(C => console.log(C.y())); -var _a; diff --git a/tests/baselines/reference/classExpressionWithStaticPropertiesES64.js b/tests/baselines/reference/classExpressionWithStaticPropertiesES64.js index d2a62d62ce9..5567d7e7cee 100644 --- a/tests/baselines/reference/classExpressionWithStaticPropertiesES64.js +++ b/tests/baselines/reference/classExpressionWithStaticPropertiesES64.js @@ -3,8 +3,8 @@ //// [classExpressionWithStaticPropertiesES64.js] +var _a; (_a = class { }, _a.x = 0, _a); -var _a; diff --git a/tests/baselines/reference/commaOperatorInConditionalExpression.js b/tests/baselines/reference/commaOperatorInConditionalExpression.js index be1705936e4..16de7776f64 100644 --- a/tests/baselines/reference/commaOperatorInConditionalExpression.js +++ b/tests/baselines/reference/commaOperatorInConditionalExpression.js @@ -8,7 +8,7 @@ function f (m: string) { //// [commaOperatorInConditionalExpression.js] function f(m) { [1, 2, 3].map(function (i) { - return true ? (_a = {}, _a[m] = i, _a) : (_b = {}, _b[m] = i + 1, _b); var _a, _b; + return true ? (_a = {}, _a[m] = i, _a) : (_b = {}, _b[m] = i + 1, _b); }); } diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsReference.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsReference.js index d5104f1dbdc..a53af0bfdb7 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsReference.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsReference.js @@ -27,6 +27,7 @@ function fn2(x4: number) { (x3['a']) **= value; //// [compoundExponentiationAssignmentLHSIsReference.js] +var _a, _b, _c; var value; // identifiers: variable and parameter var x1; @@ -45,4 +46,3 @@ function fn2(x4) { } (x3.a) = Math.pow((x3.a), value); (x3['a']) = Math.pow((x3['a']), value); -var _a, _b, _c; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index 5288737805b..b84095ae6c7 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -96,6 +96,7 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); +var _a; // expected error for all the LHS of compound assignments (arithmetic and addition) var value; // this @@ -144,18 +145,19 @@ _a = Math.pow(['', ''], value), '' = _a[0], '' = _a[1]; var Derived = /** @class */ (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.call(this) || this; - (_a = _super.prototype). = Math.pow(_a., value); + var _this = this; var _a; + _this = _super.call(this) || this; + (_a = _super.prototype). = Math.pow(_a., value); return _this; } Derived.prototype.foo = function () { - (_a = _super.prototype). = Math.pow(_a., value); var _a; + (_a = _super.prototype). = Math.pow(_a., value); }; Derived.sfoo = function () { - (_a = _super). = Math.pow(_a., value); var _a; + (_a = _super). = Math.pow(_a., value); }; return Derived; }(C)); @@ -181,4 +183,3 @@ foo() = Math.pow(foo(), value); ([]) = Math.pow(([]), value); (function baz1() { }) = Math.pow((function baz1() { }), value); (foo()) = Math.pow((foo()), value); -var _a; diff --git a/tests/baselines/reference/computedPropertiesInDestructuring1.js b/tests/baselines/reference/computedPropertiesInDestructuring1.js index e4f15e6b8bf..4a0d6db3c1d 100644 --- a/tests/baselines/reference/computedPropertiesInDestructuring1.js +++ b/tests/baselines/reference/computedPropertiesInDestructuring1.js @@ -38,14 +38,15 @@ let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}]; //// [computedPropertiesInDestructuring1.js] +var _a, _b, _c, _d, _e, _f; // destructuring in variable declarations var foo = "bar"; -var _a = foo, bar = { bar: "bar" }[_a]; +var _g = foo, bar = { bar: "bar" }[_g]; var bar2 = { bar: "bar" }["bar"]; var foo2 = function () { return "bar"; }; -var _b = foo2(), bar3 = { bar: "bar" }[_b]; -var _c = foo, bar4 = [{ bar: "bar" }][0][_c]; -var _d = foo2(), bar5 = [{ bar: "bar" }][0][_d]; +var _h = foo2(), bar3 = { bar: "bar" }[_h]; +var _j = foo, bar4 = [{ bar: "bar" }][0][_j]; +var _k = foo2(), bar5 = [{ bar: "bar" }][0][_k]; function f1(_a) { var x = _a["bar"]; } @@ -62,14 +63,13 @@ function f5(_a) { var _b = foo2(), x = _a[0][_b]; } // report errors on type errors in computed properties used in destructuring -var _e = foo(), bar6 = [{ bar: "bar" }][0][_e]; -var _f = foo.toExponential(), bar7 = [{ bar: "bar" }][0][_f]; +var _l = foo(), bar6 = [{ bar: "bar" }][0][_l]; +var _m = foo.toExponential(), bar7 = [{ bar: "bar" }][0][_m]; // destructuring assignment -(_g = foo, bar = { bar: "bar" }[_g]); +(_a = foo, bar = { bar: "bar" }[_a]); (bar2 = { bar: "bar" }["bar"]); -(_h = foo2(), bar3 = { bar: "bar" }[_h]); -_j = foo, bar4 = [{ bar: "bar" }][0][_j]; -_k = foo2(), bar5 = [{ bar: "bar" }][0][_k]; -_l = foo(), bar4 = [{ bar: "bar" }][0][_l]; -_m = (1 + {}), bar4 = [{ bar: "bar" }][0][_m]; -var _g, _h, _j, _k, _l, _m; +(_b = foo2(), bar3 = { bar: "bar" }[_b]); +_c = foo, bar4 = [{ bar: "bar" }][0][_c]; +_d = foo2(), bar5 = [{ bar: "bar" }][0][_d]; +_e = foo(), bar4 = [{ bar: "bar" }][0][_e]; +_f = (1 + {}), bar4 = [{ bar: "bar" }][0][_f]; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index 302f9355be8..01e11d237f1 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -17,6 +17,7 @@ var v = { } //// [computedPropertyNames10_ES5.js] +var _a; var s; var n; var a; @@ -33,4 +34,3 @@ var v = (_a = {}, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 568cce441e1..78247461c14 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -17,6 +17,7 @@ var v = { } //// [computedPropertyNames11_ES5.js] +var _a; var s; var n; var a; @@ -77,4 +78,3 @@ var v = (_a = {}, configurable: true }), _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js index e8bcf325c34..0245bfd3b2a 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES5.js +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -26,8 +26,8 @@ var C = /** @class */ (function () { this[_b] = 2; this["hello bye"] = 0; } + var _a, _b, _c; _a = n, s + s, _b = s + n, +s, _c = "hello " + a + " bye"; C[_c] = 0; return C; - var _a, _b, _c; }()); diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.js b/tests/baselines/reference/computedPropertyNames12_ES6.js index 6f91ec92cc9..f56dbf287a8 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES6.js +++ b/tests/baselines/reference/computedPropertyNames12_ES6.js @@ -17,6 +17,7 @@ class C { } //// [computedPropertyNames12_ES6.js] +var _a, _b, _c; var s; var n; var a; @@ -29,4 +30,3 @@ class C { } _a = n, s + s, _b = s + n, +s, _c = `hello ${a} bye`; C[_c] = 0; -var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index a62af506531..2f9a0dc689c 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -7,8 +7,8 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { + var _a; var obj = (_a = {}, _a[this.bar] = 0, _a); - var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index bda3e01bbed..8d471863586 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -8,8 +8,8 @@ module M { //// [computedPropertyNames19_ES5.js] var M; (function (M) { + var _a; var obj = (_a = {}, _a[this.bar] = 0, _a); - var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index 75bbe909927..b93096f6821 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -5,6 +5,7 @@ var v = { } //// [computedPropertyNames1_ES5.js] +var _a; var v = (_a = {}, Object.defineProperty(_a, 0 + 1, { get: function () { return 0; }, @@ -18,4 +19,3 @@ var v = (_a = {}, configurable: true }), _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 1eec0a7bcdb..88e79b47143 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -4,7 +4,7 @@ var obj = { } //// [computedPropertyNames20_ES5.js] +var _a; var obj = (_a = {}, _a[this.bar] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index 10d34ef1fe0..68c6a36d217 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,11 +13,11 @@ var C = /** @class */ (function () { function C() { } C.prototype.bar = function () { + var _a; var obj = (_a = {}, _a[this.bar()] = function () { }, _a); return 0; - var _a; }; return C; }()); diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js index a98afb70108..1444218f32c 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.js +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -10,6 +10,7 @@ class C { //// [computedPropertyNames23_ES5.js] var C = /** @class */ (function () { + var _a; function C() { } C.prototype.bar = function () { @@ -17,5 +18,4 @@ var C = /** @class */ (function () { }; C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { }; return C; - var _a; }()); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 5dcb4c7b163..ef64ae3c5bc 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -38,11 +38,11 @@ var C = /** @class */ (function (_super) { return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { + var _a; var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, _a); return 0; - var _a; }; return C; }(Base)); diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 4bcb8188d1a..c9c0225dd1b 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -30,11 +30,11 @@ var Base = /** @class */ (function () { return Base; }()); var C = /** @class */ (function (_super) { + var _a; __extends(C, _super); function C() { return _super !== null && _super.apply(this, arguments) || this; } C.prototype[(_a = {}, _a[_super.bar.call(this)] = 1, _a)[0]] = function () { }; return C; - var _a; }(Base)); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 76a50521a79..ee506fb1c1b 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -29,12 +29,12 @@ var Base = /** @class */ (function () { var C = /** @class */ (function (_super) { __extends(C, _super); function C() { + var _a; var _this = _super.call(this) || this; var obj = (_a = {}, _a[(_this = _super.call(this) || this, "prop")] = function () { }, _a); return _this; - var _a; } return C; }(Base)); diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 403f5aa2cec..18d90602d65 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,11 +17,11 @@ var C = /** @class */ (function () { C.prototype.bar = function () { var _this = this; (function () { + var _a; var obj = (_a = {}, _a[_this.bar()] = function () { } // needs capture , _a); - var _a; }); return 0; }; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 1c3b4caeb45..2cbad2aa19d 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -36,13 +36,13 @@ var C = /** @class */ (function (_super) { function C() { var _this = _super.call(this) || this; (function () { + var _a; var obj = (_a = {}, // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. _a[(_this = _super.call(this) || this, "prop")] = function () { }, _a); - var _a; }); return _this; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index b205c7025ca..8eacc21f680 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -42,11 +42,11 @@ var C = /** @class */ (function (_super) { C.prototype.foo = function () { var _this = this; (function () { + var _a; var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { } // needs capture , _a); - var _a; }); return 0; }; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 76f9e4c06d8..10a121031d5 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -15,11 +15,11 @@ var C = /** @class */ (function () { function C() { } C.prototype.bar = function () { + var _a; var obj = (_a = {}, _a[foo()] = function () { }, _a); return 0; - var _a; }; return C; }()); diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index 315e41e403e..ab0c4c10e32 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -15,11 +15,11 @@ var C = /** @class */ (function () { function C() { } C.bar = function () { + var _a; var obj = (_a = {}, _a[foo()] = function () { }, _a); return 0; - var _a; }; return C; }()); diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 815f5769f3b..5f826b8db4f 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -4,7 +4,7 @@ var o = { }; //// [computedPropertyNames46_ES5.js] +var _a; var o = (_a = {}, _a["" || 0] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index a2fff2110b4..f423d230fe9 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -6,6 +6,7 @@ var o = { }; //// [computedPropertyNames47_ES5.js] +var _a; var E1; (function (E1) { E1[E1["x"] = 0] = "x"; @@ -17,4 +18,3 @@ var E2; var o = (_a = {}, _a[E1.x || E2.x] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index 55b08ef8301..b4e2d95634b 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -18,6 +18,7 @@ extractIndexer({ }); // Should return any (widened form of undefined) //// [computedPropertyNames48_ES5.js] +var _a, _b, _c; var E; (function (E) { E[E["x"] = 0] = "x"; @@ -32,4 +33,3 @@ extractIndexer((_b = {}, extractIndexer((_c = {}, _c["" || 0] = "", _c)); // Should return any (widened form of undefined) -var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index d5e250fb037..a1ec1540b6f 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -25,6 +25,7 @@ var x = { } //// [computedPropertyNames49_ES5.js] +var _a; var x = (_a = { p1: 10 }, @@ -61,4 +62,3 @@ var x = (_a = { }), _a.p2 = 20, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index ac0fa8ec937..1c966e63bb5 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -17,6 +17,7 @@ var v = { } //// [computedPropertyNames4_ES5.js] +var _a; var s; var n; var a; @@ -33,4 +34,3 @@ var v = (_a = {}, _a["hello bye"] = 0, _a["hello " + a + " bye"] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index 5f1766c993e..86653855b55 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -25,6 +25,7 @@ var x = { } //// [computedPropertyNames50_ES5.js] +var _a; var x = (_a = { p1: 10, get foo() { @@ -57,4 +58,3 @@ var x = (_a = { }), _a.p2 = 20, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames51_ES5.js b/tests/baselines/reference/computedPropertyNames51_ES5.js index 9f138b37f3d..9766d6d1789 100644 --- a/tests/baselines/reference/computedPropertyNames51_ES5.js +++ b/tests/baselines/reference/computedPropertyNames51_ES5.js @@ -11,11 +11,11 @@ function f() { //// [computedPropertyNames51_ES5.js] function f() { + var _a; var t; var k; var v = (_a = {}, _a[t] = 0, _a[k] = 1, _a); - var _a; } diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 3367faa2c20..1189830858f 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -10,6 +10,7 @@ var v = { } //// [computedPropertyNames5_ES5.js] +var _a; var b; var v = (_a = {}, _a[b] = 0, @@ -19,4 +20,3 @@ var v = (_a = {}, _a[undefined] = undefined, _a[null] = null, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 29d035bfcbf..0b3e1eeb742 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -9,6 +9,7 @@ var v = { } //// [computedPropertyNames6_ES5.js] +var _a; var p1; var p2; var p3; @@ -17,4 +18,3 @@ var v = (_a = {}, _a[p2] = 1, _a[p3] = 2, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 01cf2efc030..6adc38b410c 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -7,6 +7,7 @@ var v = { } //// [computedPropertyNames7_ES5.js] +var _a; var E; (function (E) { E[E["member"] = 0] = "member"; @@ -14,4 +15,3 @@ var E; var v = (_a = {}, _a[E.member] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 82d262c7e4e..cffe76ff996 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -10,11 +10,11 @@ function f() { //// [computedPropertyNames8_ES5.js] function f() { + var _a; var t; var u; var v = (_a = {}, _a[t] = 0, _a[u] = 1, _a); - var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index b1ac6c9e3b6..0afb77c12f6 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -11,10 +11,10 @@ var v = { } //// [computedPropertyNames9_ES5.js] +var _a; function f(x) { } var v = (_a = {}, _a[f("")] = 0, _a[f(0)] = 0, _a[f(true)] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index d8a33951d4a..b672ed16723 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -9,8 +9,8 @@ var o: I = { } //// [computedPropertyNamesContextualType10_ES5.js] +var _a; var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index 1ee88351154..3b48f95c99d 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] +var _a; var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = function (y) { return y.length; }, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 6be09e4bef3..c33ae2b10a2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] +var _a; var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = function (y) { return y.length; }, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index b510cda2916..b0599c37bb0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,8 +9,8 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] +var _a; var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = function (y) { return y.length; }, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index 0c319a526f4..f0c7a2db6d4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType4_ES5.js] +var _a; var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index 51d78be59d4..7faaeb62b1c 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType5_ES5.js] +var _a; var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index c6ef45d7fab..a385d78079d 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -14,6 +14,7 @@ foo({ }); //// [computedPropertyNamesContextualType6_ES5.js] +var _a; foo((_a = { p: "", 0: function () { } @@ -22,4 +23,3 @@ foo((_a = { _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 14165302d3b..7ec0fea3d8e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -20,6 +20,7 @@ g({ p: "" }); //// [computedPropertyNamesContextualType7_ES5.js] +var _a; foo((_a = { 0: function () { } }, @@ -28,4 +29,3 @@ foo((_a = { _a[+"hi"] = [0], _a)); g({ p: "" }); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 24f6218864c..200acdefb1e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType8_ES5.js] +var _a; var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index 340802da2af..79eef211938 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType9_ES5.js] +var _a; var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); -var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index bf589768b72..0a7f9a7866a 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,6 +7,7 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] +var _a; var v = (_a = {}, _a["" + ""] = 0, _a["" + ""] = function () { }, @@ -21,7 +22,6 @@ var v = (_a = {}, configurable: true }), _a); -var _a; //// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index d214a1ef99d..65dc5601878 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -9,6 +9,7 @@ var v = { } //// [computedPropertyNamesSourceMap2_ES5.js] +var _a; var v = (_a = {}, _a["hello"] = function () { debugger; @@ -21,5 +22,4 @@ var v = (_a = {}, configurable: true }), _a); -var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 24dd2e2afb7..8be065a8182 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;IACD,GAAC,OAAO,IAAR;QACI,QAAQ,CAAC;IAChB,CAAC;0BACM,aAAW;aAAf;YACF,OAAO,CAAC,CAAC;QACV,CAAC;;;;OACD,CAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC;IACD,GAAC,OAAO,IAAR;QACI,QAAQ,CAAC;IAChB,CAAC;0BACM,aAAW;aAAf;YACF,OAAO,CAAC,CAAC;QACV,CAAC;;;;OACD,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 9b44702cb22..f22de8aaeab 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -8,6 +8,7 @@ sources: computedPropertyNamesSourceMap2_ES5.ts emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js sourceFile:computedPropertyNamesSourceMap2_ES5.ts ------------------------------------------------------------------- +>>>var _a; >>>var v = (_a = {}, 1 > 2 >^^^^ @@ -16,9 +17,9 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 1 > 2 >var 3 > v -1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) -3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +1 >Emitted(2, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(2, 6) Source(1, 6) + SourceIndex(0) --- >>> _a["hello"] = function () { 1->^^^^ @@ -30,10 +31,10 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 > [ 3 > "hello" 4 > -1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) -3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) -4 >Emitted(2, 19) Source(2, 5) + SourceIndex(0) +1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(3, 8) Source(2, 6) + SourceIndex(0) +3 >Emitted(3, 15) Source(2, 13) + SourceIndex(0) +4 >Emitted(3, 19) Source(2, 5) + SourceIndex(0) --- >>> debugger; 1 >^^^^^^^^ @@ -43,9 +44,9 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts > 2 > debugger 3 > ; -1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) -2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) -3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) +1 >Emitted(4, 9) Source(3, 9) + SourceIndex(0) +2 >Emitted(4, 17) Source(3, 17) + SourceIndex(0) +3 >Emitted(4, 18) Source(3, 18) + SourceIndex(0) --- >>> }, 1 >^^^^ @@ -54,8 +55,8 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 1 > > 2 > } -1 >Emitted(4, 5) Source(4, 2) + SourceIndex(0) -2 >Emitted(4, 6) Source(4, 3) + SourceIndex(0) +1 >Emitted(5, 5) Source(4, 2) + SourceIndex(0) +2 >Emitted(5, 6) Source(4, 3) + SourceIndex(0) --- >>> Object.defineProperty(_a, "goodbye", { 1->^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,14 +64,14 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 1->, > get 2 > ["goodbye"] -1->Emitted(5, 27) Source(5, 9) + SourceIndex(0) -2 >Emitted(5, 40) Source(5, 20) + SourceIndex(0) +1->Emitted(6, 27) Source(5, 9) + SourceIndex(0) +2 >Emitted(6, 40) Source(5, 20) + SourceIndex(0) --- >>> get: function () { 1 >^^^^^^^^^^^^^ 2 > ^^^^^^^^^-> 1 > -1 >Emitted(6, 14) Source(5, 5) + SourceIndex(0) +1 >Emitted(7, 14) Source(5, 5) + SourceIndex(0) --- >>> return 0; 1->^^^^^^^^^^^^ @@ -82,10 +83,10 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 > return 3 > 0 4 > ; -1->Emitted(7, 13) Source(6, 3) + SourceIndex(0) -2 >Emitted(7, 20) Source(6, 10) + SourceIndex(0) -3 >Emitted(7, 21) Source(6, 11) + SourceIndex(0) -4 >Emitted(7, 22) Source(6, 12) + SourceIndex(0) +1->Emitted(8, 13) Source(6, 3) + SourceIndex(0) +2 >Emitted(8, 20) Source(6, 10) + SourceIndex(0) +3 >Emitted(8, 21) Source(6, 11) + SourceIndex(0) +4 >Emitted(8, 22) Source(6, 12) + SourceIndex(0) --- >>> }, 1 >^^^^^^^^ @@ -94,8 +95,8 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 1 > > 2 > } -1 >Emitted(8, 9) Source(7, 2) + SourceIndex(0) -2 >Emitted(8, 10) Source(7, 3) + SourceIndex(0) +1 >Emitted(9, 9) Source(7, 2) + SourceIndex(0) +2 >Emitted(9, 10) Source(7, 3) + SourceIndex(0) --- >>> enumerable: true, >>> configurable: true @@ -103,11 +104,11 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts >>> _a); 1->^^^^^^^ 2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> >} 2 > -1->Emitted(12, 8) Source(8, 2) + SourceIndex(0) -2 >Emitted(12, 9) Source(8, 2) + SourceIndex(0) +1->Emitted(13, 8) Source(8, 2) + SourceIndex(0) +2 >Emitted(13, 9) Source(8, 2) + SourceIndex(0) --- ->>>var _a; >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes1.types b/tests/baselines/reference/conditionalTypes1.types index 90d2703d034..699808c1f78 100644 --- a/tests/baselines/reference/conditionalTypes1.types +++ b/tests/baselines/reference/conditionalTypes1.types @@ -927,9 +927,9 @@ type T52 = IsNever; // false >IsNever : IsNever function f22(x: T extends (infer U)[] ? U[] : never) { ->f22 : (x: T extends infer U[] ? U[] : never) => void +>f22 : (x: T extends (infer U)[] ? U[] : never) => void >T : T ->x : T extends infer U[] ? U[] : never +>x : T extends (infer U)[] ? U[] : never >T : T >U : U >U : U @@ -937,14 +937,14 @@ function f22(x: T extends (infer U)[] ? U[] : never) { let e = x[0]; // {} >e : {} >x[0] : {} ->x : T extends infer U[] ? U[] : never +>x : T extends (infer U)[] ? U[] : never >0 : 0 } function f23(x: T extends (infer U)[] ? U[] : never) { ->f23 : (x: T extends infer U[] ? U[] : never) => void +>f23 : (x: T extends (infer U)[] ? U[] : never) => void >T : T ->x : T extends infer U[] ? U[] : never +>x : T extends (infer U)[] ? U[] : never >T : T >U : U >U : U @@ -952,7 +952,7 @@ function f23(x: T extends (infer U)[] ? U[] : never) { let e = x[0]; // string >e : string >x[0] : string ->x : T extends infer U[] ? U[] : never +>x : T extends (infer U)[] ? U[] : never >0 : 0 } diff --git a/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js index c50c771896b..5f8e4143f3e 100644 --- a/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js +++ b/tests/baselines/reference/contextuallyTypedClassExpressionMethodDeclaration01.js @@ -60,6 +60,7 @@ function getFoo1() { }()); } function getFoo2() { + var _a; return _a = /** @class */ (function () { function class_2() { } @@ -72,9 +73,9 @@ function getFoo2() { arg.strProp = "hello"; }, _a; - var _a; } function getFoo3() { + var _a; return _a = /** @class */ (function () { function class_3() { } @@ -87,5 +88,4 @@ function getFoo3() { arg.strProp = "hello"; }, _a; - var _a; } diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.types b/tests/baselines/reference/controlFlowBinaryOrExpression.types index e843844ebf1..2cdf6b6bc19 100644 --- a/tests/baselines/reference/controlFlowBinaryOrExpression.types +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.types @@ -62,21 +62,21 @@ declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; >HTMLCollection : HTMLCollection type EventTargetLike = {a: string} | HTMLCollection | NodeList; ->EventTargetLike : NodeList | HTMLCollection | { a: string; } +>EventTargetLike : EventTargetLike >a : string >HTMLCollection : HTMLCollection >NodeList : NodeList var sourceObj: EventTargetLike = undefined; ->sourceObj : NodeList | HTMLCollection | { a: string; } ->EventTargetLike : NodeList | HTMLCollection | { a: string; } +>sourceObj : EventTargetLike +>EventTargetLike : EventTargetLike >undefined : any >undefined : undefined if (isNodeList(sourceObj)) { >isNodeList(sourceObj) : boolean >isNodeList : (sourceObj: any) => sourceObj is NodeList ->sourceObj : NodeList | HTMLCollection | { a: string; } +>sourceObj : EventTargetLike sourceObj.length; >sourceObj.length : number @@ -87,7 +87,7 @@ if (isNodeList(sourceObj)) { if (isHTMLCollection(sourceObj)) { >isHTMLCollection(sourceObj) : boolean >isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection ->sourceObj : NodeList | HTMLCollection | { a: string; } +>sourceObj : EventTargetLike sourceObj.length; >sourceObj.length : number @@ -99,7 +99,7 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { >isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean >isNodeList(sourceObj) : boolean >isNodeList : (sourceObj: any) => sourceObj is NodeList ->sourceObj : NodeList | HTMLCollection | { a: string; } +>sourceObj : EventTargetLike >isHTMLCollection(sourceObj) : boolean >isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection >sourceObj : { a: string; } diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.js b/tests/baselines/reference/correctOrderOfPromiseMethod.js index d28dbd66098..d0b8adf9eed 100644 --- a/tests/baselines/reference/correctOrderOfPromiseMethod.js +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.js @@ -63,8 +63,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) { }; function countEverything() { return __awaiter(this, void 0, void 0, function () { - var _this = this; var providerA, providerB, _a, resultA, resultB, dataA, dataB; + var _this = this; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.errors.txt deleted file mode 100644 index 4ea18c15901..00000000000 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.errors.txt +++ /dev/null @@ -1,132 +0,0 @@ -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(15,21): error TS4043: Return type of public getter 'foo1' from exported class has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(20,13): error TS4043: Return type of public getter 'foo2' from exported class has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(25,25): error TS4037: Parameter type of public setter 'foo3' from exported class has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(32,25): error TS4037: Parameter type of public setter 'foo4' from exported class has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(36,21): error TS4043: Return type of public getter 'foo5' from exported class has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(71,23): error TS4043: Return type of public getter 'foo111' from exported class has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(76,13): error TS4042: Return type of public getter 'foo112' from exported class has or is using name 'm2.public2' from private module 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(81,27): error TS4037: Parameter type of public setter 'foo113' from exported class has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(88,27): error TS4037: Parameter type of public setter 'foo114' from exported class has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts(92,23): error TS4043: Return type of public getter 'foo115' from exported class has or is using private name 'm2'. - - -==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorAccessors.ts (10 errors) ==== - module m { - class private1 { - } - - export class public1 { - } - - module m2 { - export class public2 { - } - } - - export class c { - // getter with annotation - get foo1(): private1 { - ~~~~~~~~ -!!! error TS4043: Return type of public getter 'foo1' from exported class has or is using private name 'private1'. - return; - } - - // getter without annotation - get foo2() { - ~~~~ -!!! error TS4043: Return type of public getter 'foo2' from exported class has or is using private name 'private1'. - return new private1(); - } - - // setter with annotation - set foo3(param: private1) { - ~~~~~~~~ -!!! error TS4037: Parameter type of public setter 'foo3' from exported class has or is using private name 'private1'. - } - - // Both - getter without annotation, setter with annotation - get foo4() { - return new private1(); - } - set foo4(param: private1) { - ~~~~~~~~ -!!! error TS4037: Parameter type of public setter 'foo4' from exported class has or is using private name 'private1'. - } - - // Both - with annotation - get foo5(): private1 { - ~~~~~~~~ -!!! error TS4043: Return type of public getter 'foo5' from exported class has or is using private name 'private1'. - return; - } - set foo5(param: private1) { - } - - // getter with annotation - get foo11(): public1 { - return; - } - - // getter without annotation - get foo12() { - return new public1(); - } - - // setter with annotation - set foo13(param: public1) { - } - - // Both - getter without annotation, setter with annotation - get foo14() { - return new public1(); - } - set foo14(param: public1) { - } - - // Both - with annotation - get foo15(): public1 { - return; - } - set foo15(param: public1) { - } - - // getter with annotation - get foo111(): m2.public2 { - ~~ -!!! error TS4043: Return type of public getter 'foo111' from exported class has or is using private name 'm2'. - return; - } - - // getter without annotation - get foo112() { - ~~~~~~ -!!! error TS4042: Return type of public getter 'foo112' from exported class has or is using name 'm2.public2' from private module 'm2'. - return new m2.public2(); - } - - // setter with annotation - set foo113(param: m2.public2) { - ~~ -!!! error TS4037: Parameter type of public setter 'foo113' from exported class has or is using private name 'm2'. - } - - // Both - getter without annotation, setter with annotation - get foo114() { - return new m2.public2(); - } - set foo114(param: m2.public2) { - ~~ -!!! error TS4037: Parameter type of public setter 'foo114' from exported class has or is using private name 'm2'. - } - - // Both - with annotation - get foo115(): m2.public2 { - ~~ -!!! error TS4043: Return type of public getter 'foo115' from exported class has or is using private name 'm2'. - return; - } - set foo115(param: m2.public2) { - } - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.js index c02807207ca..20d784489d9 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorAccessors.js @@ -258,3 +258,33 @@ var m; }()); m.c = c; })(m || (m = {})); + + +//// [declFileTypeAnnotationVisibilityErrorAccessors.d.ts] +declare module m { + class private1 { + } + class public1 { + } + module m2 { + class public2 { + } + } + class c { + readonly foo1: private1; + readonly foo2: private1; + foo3: private1; + foo4: private1; + foo5: private1; + readonly foo11: public1; + readonly foo12: public1; + foo13: public1; + foo14: public1; + foo15: public1; + readonly foo111: m2.public2; + readonly foo112: m2.public2; + foo113: m2.public2; + foo114: m2.public2; + foo115: m2.public2; + } +} diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.errors.txt deleted file mode 100644 index 339ae67eea4..00000000000 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.errors.txt +++ /dev/null @@ -1,59 +0,0 @@ -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts(14,34): error TS4078: Parameter 'param' of exported function has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts(16,26): error TS4078: Parameter 'param' of exported function has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts(39,35): error TS4078: Parameter 'param' of exported function has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts(41,28): error TS4077: Parameter 'param' of exported function has or is using name 'm2.public2' from private module 'm2'. - - -==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorParameterOfFunction.ts (4 errors) ==== - module m { - class private1 { - } - - export class public1 { - } - - // Directly using names from this module - function foo1(param: private1) { - } - function foo2(param = new private1()) { - } - - export function foo3(param : private1) { - ~~~~~~~~ -!!! error TS4078: Parameter 'param' of exported function has or is using private name 'private1'. - } - export function foo4(param = new private1()) { - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4078: Parameter 'param' of exported function has or is using private name 'private1'. - } - - function foo11(param: public1) { - } - function foo12(param = new public1()) { - } - - export function foo13(param: public1) { - } - export function foo14(param = new public1()) { - } - - module m2 { - export class public2 { - } - } - - function foo111(param: m2.public2) { - } - function foo112(param = new m2.public2()) { - } - - export function foo113(param: m2.public2) { - ~~ -!!! error TS4078: Parameter 'param' of exported function has or is using private name 'm2'. - } - export function foo114(param = new m2.public2()) { - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4077: Parameter 'param' of exported function has or is using name 'm2.public2' from private module 'm2'. - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.js index 1c4a27cee61..4e1edd7fe39 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorParameterOfFunction.js @@ -105,3 +105,22 @@ var m; } m.foo114 = foo114; })(m || (m = {})); + + +//// [declFileTypeAnnotationVisibilityErrorParameterOfFunction.d.ts] +declare module m { + class private1 { + } + class public1 { + } + function foo3(param: private1): void; + function foo4(param?: private1): void; + function foo13(param: public1): void; + function foo14(param?: public1): void; + module m2 { + class public2 { + } + } + function foo113(param: m2.public2): void; + function foo114(param?: m2.public2): void; +} diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.errors.txt deleted file mode 100644 index 492e6615efa..00000000000 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.errors.txt +++ /dev/null @@ -1,71 +0,0 @@ -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(16,29): error TS4060: Return type of exported function has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(19,21): error TS4060: Return type of exported function has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(49,31): error TS4060: Return type of exported function has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts(52,21): error TS4059: Return type of exported function has or is using name 'm2.public2' from private module 'm2'. - - -==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.ts (4 errors) ==== - module m { - class private1 { - } - - export class public1 { - } - - // Directly using names from this module - function foo1(): private1 { - return; - } - function foo2() { - return new private1(); - } - - export function foo3(): private1 { - ~~~~~~~~ -!!! error TS4060: Return type of exported function has or is using private name 'private1'. - return; - } - export function foo4() { - ~~~~ -!!! error TS4060: Return type of exported function has or is using private name 'private1'. - return new private1(); - } - - function foo11(): public1 { - return; - } - function foo12() { - return new public1(); - } - - export function foo13(): public1 { - return; - } - export function foo14() { - return new public1(); - } - - module m2 { - export class public2 { - } - } - - function foo111(): m2.public2 { - return; - } - function foo112() { - return new m2.public2(); - } - - export function foo113(): m2.public2 { - ~~ -!!! error TS4060: Return type of exported function has or is using private name 'm2'. - return; - } - export function foo114() { - ~~~~~~ -!!! error TS4059: Return type of exported function has or is using name 'm2.public2' from private module 'm2'. - return new m2.public2(); - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.js index a0e43b6521d..8a2437a2ac4 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.js @@ -123,3 +123,22 @@ var m; } m.foo114 = foo114; })(m || (m = {})); + + +//// [declFileTypeAnnotationVisibilityErrorReturnTypeOfFunction.d.ts] +declare module m { + class private1 { + } + class public1 { + } + function foo3(): private1; + function foo4(): private1; + function foo13(): public1; + function foo14(): public1; + module m2 { + class public2 { + } + } + function foo113(): m2.public2; + function foo114(): m2.public2; +} diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.errors.txt deleted file mode 100644 index 919fd5cd657..00000000000 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.errors.txt +++ /dev/null @@ -1,55 +0,0 @@ -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeAlias.ts(9,23): error TS4025: Exported variable 'p' has or is using private name 'W'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeAlias.ts(32,22): error TS4081: Exported type alias 't2' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeAlias.ts(35,23): error TS4081: Exported type alias 't12' has or is using private name 'public1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeAlias.ts(38,24): error TS4081: Exported type alias 't112' has or is using private name 'm3'. - - -==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeAlias.ts (4 errors) ==== - interface Window { - someMethod(); - } - - module M { - type W = Window | string; - export module N { - export class Window { } - export var p: W; // Should report error that W is private - ~ -!!! error TS4025: Exported variable 'p' has or is using private name 'W'. - } - } - - module M1 { - export type W = Window | string; - export module N { - export class Window { } - export var p: W; // No error - } - } - - module M2 { - class private1 { - } - class public1 { - } - module m3 { - export class public1 { - } - } - - type t1 = private1; - export type t2 = private1; // error - ~~~~~~~~ -!!! error TS4081: Exported type alias 't2' has or is using private name 'private1'. - - type t11 = public1; - export type t12 = public1; - ~~~~~~~ -!!! error TS4081: Exported type alias 't12' has or is using private name 'public1'. - - type t111 = m3.public1; - export type t112 = m3.public1; // error - ~~ -!!! error TS4081: Exported type alias 't112' has or is using private name 'm3'. - } - \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js index 2d1e3d1880e..fd39a6e20d9 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.js @@ -87,3 +87,38 @@ var M2; m3.public1 = public1; })(m3 || (m3 = {})); })(M2 || (M2 = {})); + + +//// [declFileTypeAnnotationVisibilityErrorTypeAlias.d.ts] +interface Window { + someMethod(): any; +} +declare module M { + type W = Window | string; + module N { + class Window { + } + var p: W; + } +} +declare module M1 { + type W = Window | string; + module N { + class Window { + } + var p: W; + } +} +declare module M2 { + class private1 { + } + class public1 { + } + module m3 { + class public1 { + } + } + type t2 = private1; + type t12 = public1; + type t112 = m3.public1; +} diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types index 5d467f07df4..24911343bea 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types @@ -10,7 +10,7 @@ module M { >M : typeof M type W = Window | string; ->W : string | Window +>W : W >Window : Window export module N { @@ -20,8 +20,8 @@ module M { >Window : Window export var p: W; // Should report error that W is private ->p : string | Window ->W : string | Window +>p : W +>W : W } } diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.errors.txt deleted file mode 100644 index a8d8023e830..00000000000 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.errors.txt +++ /dev/null @@ -1,90 +0,0 @@ -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(10,12): error TS4025: Exported variable 'x' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(11,12): error TS4025: Exported variable 'x' has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(12,13): error TS4025: Exported variable 'x' has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(13,19): error TS4025: Exported variable 'x' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(14,22): error TS4025: Exported variable 'x' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(15,22): error TS4025: Exported variable 'x' has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(17,16): error TS4024: Exported variable 'x2' has or is using name 'm2.public1' from private module 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(17,16): error TS4025: Exported variable 'x2' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(24,16): error TS4024: Exported variable 'x3' has or is using name 'm2.public1' from private module 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(24,16): error TS4025: Exported variable 'x3' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(27,23): error TS4025: Exported variable 'y' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(27,36): error TS4025: Exported variable 'y' has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(28,16): error TS4024: Exported variable 'y2' has or is using name 'm2.public1' from private module 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(28,16): error TS4025: Exported variable 'y2' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(31,27): error TS4025: Exported variable 'z' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(31,40): error TS4025: Exported variable 'z' has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(32,16): error TS4024: Exported variable 'z2' has or is using name 'm2.public1' from private module 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(32,16): error TS4025: Exported variable 'z2' has or is using private name 'private1'. - - -==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts (18 errors) ==== - module m { - class private1 { - } - module m2 { - export class public1 { - } - } - - export var x: { - x: private1; - ~~~~~~~~ -!!! error TS4025: Exported variable 'x' has or is using private name 'private1'. - y: m2.public1; - ~~ -!!! error TS4025: Exported variable 'x' has or is using private name 'm2'. - (): m2.public1[]; - ~~ -!!! error TS4025: Exported variable 'x' has or is using private name 'm2'. - method(): private1; - ~~~~~~~~ -!!! error TS4025: Exported variable 'x' has or is using private name 'private1'. - [n: number]: private1; - ~~~~~~~~ -!!! error TS4025: Exported variable 'x' has or is using private name 'private1'. - [s: string]: m2.public1; - ~~ -!!! error TS4025: Exported variable 'x' has or is using private name 'm2'. - }; - export var x2 = { - ~~ -!!! error TS4024: Exported variable 'x2' has or is using name 'm2.public1' from private module 'm2'. - ~~ -!!! error TS4025: Exported variable 'x2' has or is using private name 'private1'. - x: new private1(), - y: new m2.public1(), - method() { - return new private1(); - } - }; - export var x3 = x; - ~~ -!!! error TS4024: Exported variable 'x3' has or is using name 'm2.public1' from private module 'm2'. - ~~ -!!! error TS4025: Exported variable 'x3' has or is using private name 'private1'. - - // Function type - export var y: (a: private1) => m2.public1; - ~~~~~~~~ -!!! error TS4025: Exported variable 'y' has or is using private name 'private1'. - ~~ -!!! error TS4025: Exported variable 'y' has or is using private name 'm2'. - export var y2 = y; - ~~ -!!! error TS4024: Exported variable 'y2' has or is using name 'm2.public1' from private module 'm2'. - ~~ -!!! error TS4025: Exported variable 'y2' has or is using private name 'private1'. - - // constructor type - export var z: new (a: private1) => m2.public1; - ~~~~~~~~ -!!! error TS4025: Exported variable 'z' has or is using private name 'private1'. - ~~ -!!! error TS4025: Exported variable 'z' has or is using private name 'm2'. - export var z2 = z; - ~~ -!!! error TS4024: Exported variable 'z2' has or is using name 'm2.public1' from private module 'm2'. - ~~ -!!! error TS4025: Exported variable 'z2' has or is using private name 'private1'. - } \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js index 687ab02fdb6..ecb3e035e2a 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeLiteral.js @@ -61,3 +61,39 @@ var m; m.y2 = m.y; m.z2 = m.z; })(m || (m = {})); + + +//// [declFileTypeAnnotationVisibilityErrorTypeLiteral.d.ts] +declare module m { + class private1 { + } + module m2 { + class public1 { + } + } + var x: { + x: private1; + y: m2.public1; + (): m2.public1[]; + method(): private1; + [n: number]: private1; + [s: string]: m2.public1; + }; + var x2: { + x: private1; + y: m2.public1; + method(): private1; + }; + var x3: { + (): m2.public1[]; + [s: string]: m2.public1; + [n: number]: private1; + x: private1; + y: m2.public1; + method(): private1; + }; + var y: (a: private1) => m2.public1; + var y2: (a: private1) => m2.public1; + var z: new (a: private1) => m2.public1; + var z2: new (a: private1) => m2.public1; +} diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.errors.txt b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.errors.txt deleted file mode 100644 index 6a9e5961831..00000000000 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.errors.txt +++ /dev/null @@ -1,47 +0,0 @@ -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorVariableDeclaration.ts(12,19): error TS4025: Exported variable 'k' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorVariableDeclaration.ts(13,16): error TS4025: Exported variable 'l' has or is using private name 'private1'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorVariableDeclaration.ts(29,20): error TS4025: Exported variable 'k3' has or is using private name 'm2'. -tests/cases/compiler/declFileTypeAnnotationVisibilityErrorVariableDeclaration.ts(30,16): error TS4024: Exported variable 'l3' has or is using name 'm2.public2' from private module 'm2'. - - -==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorVariableDeclaration.ts (4 errors) ==== - module m { - class private1 { - } - - export class public1 { - } - - // Directly using names from this module - var x: private1; - var y = new private1(); - - export var k: private1; - ~~~~~~~~ -!!! error TS4025: Exported variable 'k' has or is using private name 'private1'. - export var l = new private1(); - ~ -!!! error TS4025: Exported variable 'l' has or is using private name 'private1'. - - var x2: public1; - var y2 = new public1(); - - export var k2: public1; - export var l2 = new public1(); - - module m2 { - export class public2 { - } - } - - var x3: m2.public2; - var y3 = new m2.public2(); - - export var k3: m2.public2; - ~~ -!!! error TS4025: Exported variable 'k3' has or is using private name 'm2'. - export var l3 = new m2.public2(); - ~~ -!!! error TS4024: Exported variable 'l3' has or is using name 'm2.public2' from private module 'm2'. - } - \ No newline at end of file diff --git a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js index 56f959a1356..6bdcedae7d7 100644 --- a/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js +++ b/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorVariableDeclaration.js @@ -66,3 +66,22 @@ var m; var y3 = new m2.public2(); m.l3 = new m2.public2(); })(m || (m = {})); + + +//// [declFileTypeAnnotationVisibilityErrorVariableDeclaration.d.ts] +declare module m { + class private1 { + } + class public1 { + } + var k: private1; + var l: private1; + var k2: public1; + var l2: public1; + module m2 { + class public2 { + } + } + var k3: m2.public2; + var l3: m2.public2; +} diff --git a/tests/baselines/reference/declInput-2.errors.txt b/tests/baselines/reference/declInput-2.errors.txt deleted file mode 100644 index f151f3e7122..00000000000 --- a/tests/baselines/reference/declInput-2.errors.txt +++ /dev/null @@ -1,39 +0,0 @@ -tests/cases/compiler/declInput-2.ts(10,21): error TS4031: Public property 'm22' of exported class has or is using private name 'C'. -tests/cases/compiler/declInput-2.ts(13,21): error TS4031: Public property 'm25' of exported class has or is using private name 'I2'. -tests/cases/compiler/declInput-2.ts(16,24): error TS4055: Return type of public method from exported class has or is using private name 'I2'. -tests/cases/compiler/declInput-2.ts(18,23): error TS4073: Parameter 'i' of public method from exported class has or is using private name 'I2'. -tests/cases/compiler/declInput-2.ts(19,21): error TS4055: Return type of public method from exported class has or is using private name 'C'. - - -==== tests/cases/compiler/declInput-2.ts (5 errors) ==== - module M { - class C { } - export class E {} - export interface I1 {} - interface I2 {} - export class D { - private c: C; // don't generate - public m1: number; - public m2: string; - public m22: C; // don't generate - ~ -!!! error TS4031: Public property 'm22' of exported class has or is using private name 'C'. - public m23: E; - public m24: I1; - public m25: I2; // don't generate - ~~ -!!! error TS4031: Public property 'm25' of exported class has or is using private name 'I2'. - public m232(): E { return null;} - public m242(): I1 { return null; } - public m252(): I2 { return null; } // don't generate - ~~ -!!! error TS4055: Return type of public method from exported class has or is using private name 'I2'. - public m26(i:I1) {} - public m262(i:I2) {} - ~~ -!!! error TS4073: Parameter 'i' of public method from exported class has or is using private name 'I2'. - public m3():C { return new C(); } - ~ -!!! error TS4055: Return type of public method from exported class has or is using private name 'C'. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/declInput-2.js b/tests/baselines/reference/declInput-2.js index 02dc3cd2819..f1f23b7f22e 100644 --- a/tests/baselines/reference/declInput-2.js +++ b/tests/baselines/reference/declInput-2.js @@ -48,3 +48,31 @@ var M; }()); M.D = D; })(M || (M = {})); + + +//// [declInput-2.d.ts] +declare module M { + class C { + } + class E { + } + interface I1 { + } + interface I2 { + } + class D { + private c; + m1: number; + m2: string; + m22: C; + m23: E; + m24: I1; + m25: I2; + m232(): E; + m242(): I1; + m252(): I2; + m26(i: I1): void; + m262(i: I2): void; + m3(): C; + } +} diff --git a/tests/baselines/reference/declarationEmitClassPrivateConstructor2.errors.txt b/tests/baselines/reference/declarationEmitClassPrivateConstructor2.errors.txt deleted file mode 100644 index a31454a4760..00000000000 --- a/tests/baselines/reference/declarationEmitClassPrivateConstructor2.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -tests/cases/compiler/declarationEmitClassPrivateConstructor2.ts(5,38): error TS4031: Public property 'data' of exported class has or is using private name 'PrivateInterface'. -tests/cases/compiler/declarationEmitClassPrivateConstructor2.ts(10,33): error TS4063: Parameter 'data' of constructor from exported class has or is using private name 'PrivateInterface'. - - -==== tests/cases/compiler/declarationEmitClassPrivateConstructor2.ts (2 errors) ==== - interface PrivateInterface { - } - - export class ExportedClass1 { - private constructor(public data: PrivateInterface) { } - ~~~~~~~~~~~~~~~~ -!!! error TS4031: Public property 'data' of exported class has or is using private name 'PrivateInterface'. - } - - - export class ExportedClass2 { - protected constructor(data: PrivateInterface) { } - ~~~~~~~~~~~~~~~~ -!!! error TS4063: Parameter 'data' of constructor from exported class has or is using private name 'PrivateInterface'. - } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitClassPrivateConstructor2.js b/tests/baselines/reference/declarationEmitClassPrivateConstructor2.js index 863b295751f..445270e00c5 100644 --- a/tests/baselines/reference/declarationEmitClassPrivateConstructor2.js +++ b/tests/baselines/reference/declarationEmitClassPrivateConstructor2.js @@ -27,3 +27,16 @@ var ExportedClass2 = /** @class */ (function () { return ExportedClass2; }()); exports.ExportedClass2 = ExportedClass2; + + +//// [declarationEmitClassPrivateConstructor2.d.ts] +interface PrivateInterface { +} +export declare class ExportedClass1 { + data: PrivateInterface; + private constructor(); +} +export declare class ExportedClass2 { + protected constructor(data: PrivateInterface); +} +export {}; diff --git a/tests/baselines/reference/declarationEmitDefaultExport7.errors.txt b/tests/baselines/reference/declarationEmitDefaultExport7.errors.txt deleted file mode 100644 index f19766cbb00..00000000000 --- a/tests/baselines/reference/declarationEmitDefaultExport7.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/compiler/declarationEmitDefaultExport7.ts(2,1): error TS4082: Default export of the module has or is using private name 'A'. - - -==== tests/cases/compiler/declarationEmitDefaultExport7.ts (1 errors) ==== - class A {} - export default new A(); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4082: Default export of the module has or is using private name 'A'. - \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExport7.js b/tests/baselines/reference/declarationEmitDefaultExport7.js index 99751113dd6..e0c72ee4225 100644 --- a/tests/baselines/reference/declarationEmitDefaultExport7.js +++ b/tests/baselines/reference/declarationEmitDefaultExport7.js @@ -7,3 +7,10 @@ export default new A(); class A { } export default new A(); + + +//// [declarationEmitDefaultExport7.d.ts] +declare class A { +} +declare const _default: A; +export default _default; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern3.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern3.js index 84ab9f242e9..b4aea71a241 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern3.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern3.js @@ -6,8 +6,8 @@ module M { //// [declarationEmitDestructuringArrayPattern3.js] var M; (function (M) { - _a = [1, 2], M.a = _a[0], M.b = _a[1]; var _a; + _a = [1, 2], M.a = _a[0], M.b = _a[1]; })(M || (M = {})); diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.js b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.js index 0414017b776..10d7427388a 100644 --- a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.js +++ b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern.js @@ -39,8 +39,8 @@ function f15() { var _f = f15(), a4 = _f.a4, b4 = _f.b4, c4 = _f.c4; var m; (function (m) { - _a = f15(), m.a4 = _a.a4, m.b4 = _a.b4, m.c4 = _a.c4; var _a; + _a = f15(), m.a4 = _a.a4, m.b4 = _a.b4, m.c4 = _a.c4; })(m || (m = {})); diff --git a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.js b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.js index 6b8add193f2..66dfe225e83 100644 --- a/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.js +++ b/tests/baselines/reference/declarationEmitDestructuringObjectLiteralPattern2.js @@ -24,8 +24,8 @@ function f15() { var _c = f15(), a4 = _c.a4, b4 = _c.b4, c4 = _c.c4; var m; (function (m) { - _a = f15(), m.a4 = _a.a4, m.b4 = _a.b4, m.c4 = _a.c4; var _a; + _a = f15(), m.a4 = _a.a4, m.b4 = _a.b4, m.c4 = _a.c4; })(m || (m = {})); diff --git a/tests/baselines/reference/declarationEmitDestructuringPrivacyError.errors.txt b/tests/baselines/reference/declarationEmitDestructuringPrivacyError.errors.txt deleted file mode 100644 index e464b96a8bf..00000000000 --- a/tests/baselines/reference/declarationEmitDestructuringPrivacyError.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/compiler/declarationEmitDestructuringPrivacyError.ts(4,20): error TS4025: Exported variable 'y' has or is using private name 'c'. - - -==== tests/cases/compiler/declarationEmitDestructuringPrivacyError.ts (1 errors) ==== - module m { - class c { - } - export var [x, y, z] = [10, new c(), 30]; - ~ -!!! error TS4025: Exported variable 'y' has or is using private name 'c'. - } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDestructuringPrivacyError.js b/tests/baselines/reference/declarationEmitDestructuringPrivacyError.js index 23b93d14e15..dc037d7db11 100644 --- a/tests/baselines/reference/declarationEmitDestructuringPrivacyError.js +++ b/tests/baselines/reference/declarationEmitDestructuringPrivacyError.js @@ -8,11 +8,19 @@ module m { //// [declarationEmitDestructuringPrivacyError.js] var m; (function (m) { + var _a; var c = /** @class */ (function () { function c() { } return c; }()); _a = [10, new c(), 30], m.x = _a[0], m.y = _a[1], m.z = _a[2]; - var _a; })(m || (m = {})); + + +//// [declarationEmitDestructuringPrivacyError.d.ts] +declare module m { + class c { + } + var x: number, y: c, z: number; +} diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt b/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt deleted file mode 100644 index 4864a3bcdc2..00000000000 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -tests/cases/compiler/declarationEmitExpressionInExtends3.ts(28,30): error TS4020: 'extends' clause of exported class 'MyClass' has or is using private name 'LocalClass'. -tests/cases/compiler/declarationEmitExpressionInExtends3.ts(36,75): error TS4020: 'extends' clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. - - -==== tests/cases/compiler/declarationEmitExpressionInExtends3.ts (2 errors) ==== - export class ExportedClass { - x: T; - } - - class LocalClass { - x: T; - y: U; - } - - export interface ExportedInterface { - x: number; - } - - interface LocalInterface { - x: number; - } - - function getLocalClass(c: T) { - return LocalClass; - } - - function getExportedClass(c: T) { - return ExportedClass; - } - - - - export class MyClass extends getLocalClass(undefined) { // error LocalClass is inaccisible - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4020: 'extends' clause of exported class 'MyClass' has or is using private name 'LocalClass'. - } - - - export class MyClass2 extends getExportedClass(undefined) { // OK - } - - - export class MyClass3 extends getExportedClass(undefined) { // Error LocalInterface is inaccisble - ~~~~~~~~~~~~~~ -!!! error TS4020: 'extends' clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. - } - - - export class MyClass4 extends getExportedClass(undefined) { // OK - } - \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index c97587620fd..c73268f7c55 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -104,3 +104,32 @@ var MyClass4 = /** @class */ (function (_super) { return MyClass4; }(getExportedClass(undefined))); exports.MyClass4 = MyClass4; + + +//// [declarationEmitExpressionInExtends3.d.ts] +export declare class ExportedClass { + x: T; +} +declare class LocalClass { + x: T; + y: U; +} +export interface ExportedInterface { + x: number; +} +interface LocalInterface { + x: number; +} +declare const MyClass_base: typeof LocalClass; +export declare class MyClass extends MyClass_base { +} +declare const MyClass2_base: typeof ExportedClass; +export declare class MyClass2 extends MyClass2_base { +} +declare const MyClass3_base: typeof ExportedClass; +export declare class MyClass3 extends MyClass3_base { +} +declare const MyClass4_base: typeof ExportedClass; +export declare class MyClass4 extends MyClass4_base { +} +export {}; diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.errors.txt b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.errors.txt deleted file mode 100644 index 37a4853b649..00000000000 --- a/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts(5,33): error TS4060: Return type of exported function has or is using private name 'I'. - - -==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitIdentifierPredicatesWithPrivateName01.ts (1 errors) ==== - interface I { - a: number; - } - - export function f(x: any): x is I { - ~ -!!! error TS4060: Return type of exported function has or is using private name 'I'. - return typeof x.a === "number"; - } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js index 74da01ce683..1531d09a88f 100644 --- a/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js +++ b/tests/baselines/reference/declarationEmitIdentifierPredicatesWithPrivateName01.js @@ -14,3 +14,11 @@ function f(x) { return typeof x.a === "number"; } exports.f = f; + + +//// [declarationEmitIdentifierPredicatesWithPrivateName01.d.ts] +interface I { + a: number; +} +export declare function f(x: any): x is I; +export {}; diff --git a/tests/baselines/reference/declarationEmitInferredTypeAlias9.js b/tests/baselines/reference/declarationEmitInferredTypeAlias9.js index 8d03c6b70d2..8539cfaf03e 100644 --- a/tests/baselines/reference/declarationEmitInferredTypeAlias9.js +++ b/tests/baselines/reference/declarationEmitInferredTypeAlias9.js @@ -17,6 +17,8 @@ exports.returnSomeGlobalValue = returnSomeGlobalValue; //// [declarationEmitInferredTypeAlias9.d.ts] -export declare function returnSomeGlobalValue(): number[] | { - x: number[] | any; +declare type Foo = T | { + x: Foo; }; +export declare function returnSomeGlobalValue(): Foo; +export {}; diff --git a/tests/baselines/reference/declarationEmitInferredTypeAlias9.types b/tests/baselines/reference/declarationEmitInferredTypeAlias9.types index 30a15aff6fb..ab03db6da4f 100644 --- a/tests/baselines/reference/declarationEmitInferredTypeAlias9.types +++ b/tests/baselines/reference/declarationEmitInferredTypeAlias9.types @@ -1,19 +1,19 @@ === tests/cases/compiler/declarationEmitInferredTypeAlias9.ts === type Foo = T | { x: Foo }; ->Foo : T | { x: T | any; } +>Foo : Foo >T : T >T : T ->x : T | { x: T | any; } ->Foo : T | { x: T | any; } +>x : Foo +>Foo : Foo >T : T var x: Foo; ->x : number[] | { x: number[] | any; } ->Foo : T | { x: T | any; } +>x : Foo +>Foo : Foo export function returnSomeGlobalValue() { ->returnSomeGlobalValue : () => number[] | { x: number[] | any; } +>returnSomeGlobalValue : () => Foo return x; ->x : number[] | { x: number[] | any; } +>x : Foo } diff --git a/tests/baselines/reference/declarationEmitLocalClassDeclarationMixin.js b/tests/baselines/reference/declarationEmitLocalClassDeclarationMixin.js index 352520ff575..3cbbc0e0763 100644 --- a/tests/baselines/reference/declarationEmitLocalClassDeclarationMixin.js +++ b/tests/baselines/reference/declarationEmitLocalClassDeclarationMixin.js @@ -107,3 +107,4 @@ declare const FilteredThing_base: { export declare class FilteredThing extends FilteredThing_base { match(path: string): boolean; } +export {}; diff --git a/tests/baselines/reference/declarationEmitNestedGenerics.js b/tests/baselines/reference/declarationEmitNestedGenerics.js new file mode 100644 index 00000000000..04d74e3f8db --- /dev/null +++ b/tests/baselines/reference/declarationEmitNestedGenerics.js @@ -0,0 +1,25 @@ +//// [declarationEmitNestedGenerics.ts] +function f(p: T) { + let g: (x: T) => typeof p = null as any; + return g; +} + +function g(x: T) { + let y: typeof x extends (infer T)[] ? T : typeof x = null as any; + return y; +} + +//// [declarationEmitNestedGenerics.js] +function f(p) { + var g = null; + return g; +} +function g(x) { + var y = null; + return y; +} + + +//// [declarationEmitNestedGenerics.d.ts] +declare function f(p: T): (x: T_1) => T; +declare function g(x: T): T extends (infer T_1)[] ? T_1 : T; diff --git a/tests/baselines/reference/declarationEmitNestedGenerics.symbols b/tests/baselines/reference/declarationEmitNestedGenerics.symbols new file mode 100644 index 00000000000..b2f657e6f08 --- /dev/null +++ b/tests/baselines/reference/declarationEmitNestedGenerics.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/declarationEmitNestedGenerics.ts === +function f(p: T) { +>f : Symbol(f, Decl(declarationEmitNestedGenerics.ts, 0, 0)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 0, 11)) +>p : Symbol(p, Decl(declarationEmitNestedGenerics.ts, 0, 14)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 0, 11)) + + let g: (x: T) => typeof p = null as any; +>g : Symbol(g, Decl(declarationEmitNestedGenerics.ts, 1, 7)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 1, 12)) +>x : Symbol(x, Decl(declarationEmitNestedGenerics.ts, 1, 15)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 1, 12)) +>p : Symbol(p, Decl(declarationEmitNestedGenerics.ts, 0, 14)) + + return g; +>g : Symbol(g, Decl(declarationEmitNestedGenerics.ts, 1, 7)) +} + +function g(x: T) { +>g : Symbol(g, Decl(declarationEmitNestedGenerics.ts, 3, 1)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 5, 11)) +>x : Symbol(x, Decl(declarationEmitNestedGenerics.ts, 5, 14)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 5, 11)) + + let y: typeof x extends (infer T)[] ? T : typeof x = null as any; +>y : Symbol(y, Decl(declarationEmitNestedGenerics.ts, 6, 7)) +>x : Symbol(x, Decl(declarationEmitNestedGenerics.ts, 5, 14)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 6, 34)) +>T : Symbol(T, Decl(declarationEmitNestedGenerics.ts, 6, 34)) +>x : Symbol(x, Decl(declarationEmitNestedGenerics.ts, 5, 14)) + + return y; +>y : Symbol(y, Decl(declarationEmitNestedGenerics.ts, 6, 7)) +} diff --git a/tests/baselines/reference/declarationEmitNestedGenerics.types b/tests/baselines/reference/declarationEmitNestedGenerics.types new file mode 100644 index 00000000000..778ecd8290b --- /dev/null +++ b/tests/baselines/reference/declarationEmitNestedGenerics.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/declarationEmitNestedGenerics.ts === +function f(p: T) { +>f : (p: T) => (x: T) => T +>T : T +>p : T +>T : T + + let g: (x: T) => typeof p = null as any; +>g : (x: T) => T +>T : T +>x : T +>T : T +>p : T +>null as any : any +>null : null + + return g; +>g : (x: T) => T +} + +function g(x: T) { +>g : (x: T) => T extends (infer T)[] ? T : T +>T : T +>x : T +>T : T + + let y: typeof x extends (infer T)[] ? T : typeof x = null as any; +>y : T extends (infer T)[] ? T : T +>x : T +>T : T +>T : T +>x : T +>null as any : any +>null : null + + return y; +>y : T extends (infer T)[] ? T : T +} diff --git a/tests/baselines/reference/declarationEmitPrivateNameCausesError.js b/tests/baselines/reference/declarationEmitPrivateNameCausesError.js index 802195e4cca..66cb88ba4db 100644 --- a/tests/baselines/reference/declarationEmitPrivateNameCausesError.js +++ b/tests/baselines/reference/declarationEmitPrivateNameCausesError.js @@ -24,6 +24,7 @@ exports.__esModule = true; var IGNORE_EXTRA_VARIABLES = Symbol(); //Notice how this is unexported //This is exported function ignoreExtraVariables(ctor) { + var _a, _b; return _b = /** @class */ (function (_super) { __extends(class_1, _super); function class_1() { @@ -35,7 +36,6 @@ function ignoreExtraVariables(ctor) { }(ctor)), _a = IGNORE_EXTRA_VARIABLES, _b; - var _a, _b; } exports.ignoreExtraVariables = ignoreExtraVariables; diff --git a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js index 13063135daf..91ca8405868 100644 --- a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js +++ b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js @@ -26,6 +26,7 @@ exports.x = Symbol(); //// [b.js] "use strict"; exports.__esModule = true; +var _a; var a_1 = require("./a"); var C = /** @class */ (function () { function C() { @@ -35,7 +36,6 @@ var C = /** @class */ (function () { }()); _a = a_1.x; exports.C = C; -var _a; //// [c.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -49,6 +49,7 @@ var __extends = (this && this.__extends) || (function () { }; })(); exports.__esModule = true; +var _a; var a_1 = require("./a"); var b_1 = require("./b"); var D = /** @class */ (function (_super) { @@ -62,7 +63,6 @@ var D = /** @class */ (function (_super) { }(b_1.C)); _a = a_1.x; exports.D = D; -var _a; //// [a.d.ts] diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.errors.txt b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.errors.txt deleted file mode 100644 index ea59c8fa9e8..00000000000 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts(2,18): error TS4055: Return type of public method from exported class has or is using private name 'D'. - - -==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName01.ts (1 errors) ==== - export class C { - m(): this is D { - ~ -!!! error TS4055: Return type of public method from exported class has or is using private name 'D'. - return this instanceof D; - } - } - - class D extends C { - } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js index 5bb662b5907..10305b8ed64 100644 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js @@ -37,3 +37,12 @@ var D = /** @class */ (function (_super) { } return D; }(C)); + + +//// [declarationEmitThisPredicatesWithPrivateName01.d.ts] +export declare class C { + m(): this is D; +} +declare class D extends C { +} +export {}; diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt index f80c2bd0d6f..a01ebbb4864 100644 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(7,14): error TS4025: Exported variable 'obj' has or is using private name 'Foo'. tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(8,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface. -==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (2 errors) ==== +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (1 errors) ==== interface Foo { a: string; b: number; @@ -10,8 +9,6 @@ tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredic } export const obj = { - ~~~ -!!! error TS4025: Exported variable 'obj' has or is using private name 'Foo'. m(): this is Foo { ~~~~ !!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js index 86fb2e05607..96b580a68b9 100644 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.js @@ -21,3 +21,15 @@ exports.obj = { return dis.a != null && dis.b != null && dis.c != null; } }; + + +//// [declarationEmitThisPredicatesWithPrivateName02.d.ts] +interface Foo { + a: string; + b: number; + c: boolean; +} +export declare const obj: { + m(): this is Foo; +}; +export {}; diff --git a/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.errors.txt b/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.errors.txt deleted file mode 100644 index 9552adfc0af..00000000000 --- a/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters5.ts(4,25): error TS4081: Exported type alias 'SubFoo' has or is using private name 'Foo'. - - -==== tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters5.ts (1 errors) ==== - type Foo = { - foo(): Foo - }; - export type SubFoo = Foo; - ~~~ -!!! error TS4081: Exported type alias 'SubFoo' has or is using private name 'Foo'. - - function foo() { - return {} as SubFoo; - } - \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.js b/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.js index cee701c0455..1b29acc164e 100644 --- a/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.js +++ b/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.js @@ -15,3 +15,11 @@ exports.__esModule = true; function foo() { return {}; } + + +//// [declarationEmitTypeAliasWithTypeParameters5.d.ts] +declare type Foo = { + foo(): Foo; +}; +export declare type SubFoo = Foo; +export {}; diff --git a/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.types b/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.types index 18ef901dbdc..cd98b3706f6 100644 --- a/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.types +++ b/tests/baselines/reference/declarationEmitTypeAliasWithTypeParameters5.types @@ -1,30 +1,30 @@ === tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters5.ts === type Foo = { ->Foo : { foo(): Foo; } +>Foo : Foo >T : T >Y : Y foo(): Foo ->foo : () => { foo(): Foo; } +>foo : () => Foo >U : U >J : J ->Foo : { foo(): Foo; } +>Foo : Foo >U : U >J : J }; export type SubFoo = Foo; ->SubFoo : { foo(): Foo; } +>SubFoo : Foo >R : R ->Foo : { foo(): Foo; } +>Foo : Foo >R : R function foo() { ->foo : () => { foo(): Foo; } +>foo : () => Foo return {} as SubFoo; ->{} as SubFoo : { foo(): Foo; } +>{} as SubFoo : Foo >{} : {} ->SubFoo : { foo(): Foo; } +>SubFoo : Foo } diff --git a/tests/baselines/reference/declarationFunctionTypeNonlocalShouldNotBeAnError.js b/tests/baselines/reference/declarationFunctionTypeNonlocalShouldNotBeAnError.js index 6faa0bfca60..88343a7d08e 100644 --- a/tests/baselines/reference/declarationFunctionTypeNonlocalShouldNotBeAnError.js +++ b/tests/baselines/reference/declarationFunctionTypeNonlocalShouldNotBeAnError.js @@ -20,7 +20,8 @@ var foo; //// [declarationFunctionTypeNonlocalShouldNotBeAnError.d.ts] declare namespace foo { + function bar(): void; const obj: { - bar: () => void; + bar: typeof bar; }; } diff --git a/tests/baselines/reference/declarationNoDanglingGenerics.js b/tests/baselines/reference/declarationNoDanglingGenerics.js index 9045be6827b..9ff7dfefd49 100644 --- a/tests/baselines/reference/declarationNoDanglingGenerics.js +++ b/tests/baselines/reference/declarationNoDanglingGenerics.js @@ -53,6 +53,7 @@ function register(kind) { kindCache[kind] = true; } function ClassFactory(kind) { + var _a; register(kind); return _a = /** @class */ (function () { function class_1() { @@ -62,7 +63,6 @@ function ClassFactory(kind) { }()), _a.THE_KIND = kind, _a; - var _a; } var Kinds = /** @class */ (function () { function Kinds() { @@ -123,3 +123,4 @@ declare const CKind_base: { }; export declare class CKind extends CKind_base { } +export {}; diff --git a/tests/baselines/reference/declarationsAndAssignments.js b/tests/baselines/reference/declarationsAndAssignments.js index 3a2f9ef3b4e..74d7cd94156 100644 --- a/tests/baselines/reference/declarationsAndAssignments.js +++ b/tests/baselines/reference/declarationsAndAssignments.js @@ -277,8 +277,8 @@ f14([2, ["abc", { x: 0 }]]); f14([2, ["abc", { y: false }]]); // Error, no x var M; (function (M) { - _a = [1, 2], M.a = _a[0], M.b = _a[1]; var _a; + _a = [1, 2], M.a = _a[0], M.b = _a[1]; })(M || (M = {})); function f15() { var a = "hello"; @@ -297,6 +297,7 @@ f17({ a: "hello" }); f17({ c: true }); f17(f15()); function f18() { + var _a, _b, _c, _d, _e, _f, _g; var a; var b; var aa; @@ -305,44 +306,43 @@ function f18() { _c = [a, b], aa[0] = _c[0], b = _c[1]; _d = [b, a], a = _d[0], b = _d[1]; // Error _e = [2, "def"], _f = _e[0], a = _f === void 0 ? 1 : _f, _g = _e[1], b = _g === void 0 ? "abc" : _g; - var _a, _b, _c, _d, _e, _f, _g; } function f19() { + var _a, _b, _c, _d, _e, _f; var a, b; _a = [1, 2], a = _a[0], b = _a[1]; _b = [b, a], a = _b[0], b = _b[1]; (_c = { b: b, a: a }, a = _c.a, b = _c.b); _d = [[2, 3]][0], _e = _d === void 0 ? [1, 2] : _d, a = _e[0], b = _e[1]; var x = (_f = [1, 2], a = _f[0], b = _f[1], _f); - var _a, _b, _c, _d, _e, _f; } function f20() { + var _a, _b, _c; var a; var x; var y; var z; var a = [1, 2, 3].slice(0); - var _a = [1, 2, 3], x = _a[0], a = _a.slice(1); - var _b = [1, 2, 3], x = _b[0], y = _b[1], a = _b.slice(2); - var _c = [1, 2, 3], x = _c[0], y = _c[1], z = _c[2], a = _c.slice(3); + var _d = [1, 2, 3], x = _d[0], a = _d.slice(1); + var _e = [1, 2, 3], x = _e[0], y = _e[1], a = _e.slice(2); + var _f = [1, 2, 3], x = _f[0], y = _f[1], z = _f[2], a = _f.slice(3); a = [1, 2, 3].slice(0); - _d = [1, 2, 3], x = _d[0], a = _d.slice(1); - _e = [1, 2, 3], x = _e[0], y = _e[1], a = _e.slice(2); - _f = [1, 2, 3], x = _f[0], y = _f[1], z = _f[2], a = _f.slice(3); - var _d, _e, _f; + _a = [1, 2, 3], x = _a[0], a = _a.slice(1); + _b = [1, 2, 3], x = _b[0], y = _b[1], a = _b.slice(2); + _c = [1, 2, 3], x = _c[0], y = _c[1], z = _c[2], a = _c.slice(3); } function f21() { + var _a, _b, _c; var a; var x; var y; var z; var a = [1, "hello", true].slice(0); - var _a = [1, "hello", true], x = _a[0], a = _a.slice(1); - var _b = [1, "hello", true], x = _b[0], y = _b[1], a = _b.slice(2); - var _c = [1, "hello", true], x = _c[0], y = _c[1], z = _c[2], a = _c.slice(3); + var _d = [1, "hello", true], x = _d[0], a = _d.slice(1); + var _e = [1, "hello", true], x = _e[0], y = _e[1], a = _e.slice(2); + var _f = [1, "hello", true], x = _f[0], y = _f[1], z = _f[2], a = _f.slice(3); a = [1, "hello", true].slice(0); - _d = [1, "hello", true], x = _d[0], a = _d.slice(1); - _e = [1, "hello", true], x = _e[0], y = _e[1], a = _e.slice(2); - _f = [1, "hello", true], x = _f[0], y = _f[1], z = _f[2], a = _f.slice(3); - var _d, _e, _f; + _a = [1, "hello", true], x = _a[0], a = _a.slice(1); + _b = [1, "hello", true], x = _b[0], y = _b[1], a = _b.slice(2); + _c = [1, "hello", true], x = _c[0], y = _c[1], z = _c[2], a = _c.slice(3); } diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS1.js b/tests/baselines/reference/decoratedClassExportsCommonJS1.js index b624c11e79d..befb1f9586b 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS1.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS1.js @@ -15,6 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); +var Testing123_1; let Testing123 = Testing123_1 = class Testing123 { }; Testing123.prop1 = Testing123_1.prop0; @@ -22,4 +23,3 @@ Testing123 = Testing123_1 = __decorate([ Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; -var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS2.js b/tests/baselines/reference/decoratedClassExportsCommonJS2.js index b9ef278ac73..b93e63c7406 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS2.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS2.js @@ -13,10 +13,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); +var Testing123_1; let Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; -var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsSystem1.js b/tests/baselines/reference/decoratedClassExportsSystem1.js index b32c2c9b445..5921a424524 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem1.js +++ b/tests/baselines/reference/decoratedClassExportsSystem1.js @@ -9,15 +9,15 @@ export class Testing123 { //// [a.js] System.register([], function (exports_1, context_1) { - "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; + var Testing123_1, Testing123; + "use strict"; var __moduleName = context_1 && context_1.id; - var Testing123, Testing123_1; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/decoratedClassExportsSystem2.js b/tests/baselines/reference/decoratedClassExportsSystem2.js index 99ddd29bc2c..e3f0a97b64d 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem2.js +++ b/tests/baselines/reference/decoratedClassExportsSystem2.js @@ -6,15 +6,15 @@ export class Testing123 { } //// [a.js] System.register([], function (exports_1, context_1) { - "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; + var Testing123_1, Testing123; + "use strict"; var __moduleName = context_1 && context_1.id; - var Testing123, Testing123_1; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js index 4628fc5e81c..837fdc103f8 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.js @@ -14,15 +14,15 @@ export default class {} //// [a.js] System.register([], function (exports_1, context_1) { - "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __moduleName = context_1 && context_1.id; var decorator, Foo; + "use strict"; + var __moduleName = context_1 && context_1.id; return { setters: [], execute: function () { @@ -37,15 +37,15 @@ System.register([], function (exports_1, context_1) { }); //// [b.js] System.register([], function (exports_1, context_1) { - "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __moduleName = context_1 && context_1.id; var decorator, default_1; + "use strict"; + var __moduleName = context_1 && context_1.id; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js index bec7400996e..a20ff821148 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js @@ -46,11 +46,11 @@ var MyClass = /** @class */ (function () { this.db = db; this.db.doSomething(); } + var _a; MyClass = __decorate([ someDecorator, __metadata("design:paramtypes", [typeof (_a = (typeof db_1.default !== "undefined" && db_1.default).db) === "function" && _a || Object]) ], MyClass); return MyClass; - var _a; }()); exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorOnClass5.es6.js b/tests/baselines/reference/decoratorOnClass5.es6.js index 426a93668e7..b1c45cbce31 100644 --- a/tests/baselines/reference/decoratorOnClass5.es6.js +++ b/tests/baselines/reference/decoratorOnClass5.es6.js @@ -16,6 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; +var C_1; let C = C_1 = class C { static x() { return C_1.y; } }; @@ -24,4 +25,3 @@ C = C_1 = __decorate([ dec ], C); let c = new C(); -var C_1; diff --git a/tests/baselines/reference/decoratorOnClass6.es6.js b/tests/baselines/reference/decoratorOnClass6.es6.js index 7da4a20bb93..f9d8d2f4199 100644 --- a/tests/baselines/reference/decoratorOnClass6.es6.js +++ b/tests/baselines/reference/decoratorOnClass6.es6.js @@ -16,6 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; +var C_1; let C = C_1 = class C { static x() { return C_1.y; } }; @@ -25,4 +26,3 @@ C = C_1 = __decorate([ ], C); export { C }; let c = new C(); -var C_1; diff --git a/tests/baselines/reference/decoratorOnClass7.es6.js b/tests/baselines/reference/decoratorOnClass7.es6.js index 92ee02c899e..aefc9536a87 100644 --- a/tests/baselines/reference/decoratorOnClass7.es6.js +++ b/tests/baselines/reference/decoratorOnClass7.es6.js @@ -16,6 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; +var C_1; let C = C_1 = class C { static x() { return C_1.y; } }; @@ -25,4 +26,3 @@ C = C_1 = __decorate([ ], C); export default C; let c = new C(); -var C_1; diff --git a/tests/baselines/reference/decoratorOnClass9.js b/tests/baselines/reference/decoratorOnClass9.js index 84ce76dba29..e92717f9b8a 100644 --- a/tests/baselines/reference/decoratorOnClass9.js +++ b/tests/baselines/reference/decoratorOnClass9.js @@ -45,11 +45,11 @@ var B = /** @class */ (function (_super) { B.prototype.m = function () { return B_1.x; }; + var B_1; B.x = 1; B.y = B_1.x; B = B_1 = __decorate([ dec ], B); return B; - var B_1; }(A)); diff --git a/tests/baselines/reference/decoratorsOnComputedProperties.js b/tests/baselines/reference/decoratorsOnComputedProperties.js index 4e7cf4a6ac1..2af6b460c05 100644 --- a/tests/baselines/reference/decoratorsOnComputedProperties.js +++ b/tests/baselines/reference/decoratorsOnComputedProperties.js @@ -196,6 +196,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21; function x(o, k) { } let i = 0; function foo() { return ++i + ""; } @@ -454,4 +455,3 @@ void (_21 = class J { }, _20 = fieldNameC, _21); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21; diff --git a/tests/baselines/reference/deduplicateImportsInSystem.js b/tests/baselines/reference/deduplicateImportsInSystem.js index f0ac7c83ed8..8bf49a449cc 100644 --- a/tests/baselines/reference/deduplicateImportsInSystem.js +++ b/tests/baselines/reference/deduplicateImportsInSystem.js @@ -10,9 +10,9 @@ console.log(A + B + C + D + E + F) //// [deduplicateImportsInSystem.js] System.register(["f1", "f2", "f3"], function (exports_1, context_1) { + var f1_1, f2_1, f3_1, f2_2, f2_3, f1_2; "use strict"; var __moduleName = context_1 && context_1.id; - var f1_1, f2_1, f3_1, f2_2, f2_3, f1_2; return { setters: [ function (f1_1_1) { diff --git a/tests/baselines/reference/defaultExportsGetExportedSystem.js b/tests/baselines/reference/defaultExportsGetExportedSystem.js index 089551195ae..0269905baba 100644 --- a/tests/baselines/reference/defaultExportsGetExportedSystem.js +++ b/tests/baselines/reference/defaultExportsGetExportedSystem.js @@ -9,9 +9,9 @@ export default function foo() {} //// [a.js] System.register([], function (exports_1, context_1) { + var Foo; "use strict"; var __moduleName = context_1 && context_1.id; - var Foo; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.js b/tests/baselines/reference/destructuringAssignmentWithDefault.js index fe3ccdcee53..df4addf0269 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.js +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.js @@ -5,7 +5,7 @@ let x = 0; //// [destructuringAssignmentWithDefault.js] +var _a; var a = {}; var x = 0; (_a = a.x, x = _a === void 0 ? 1 : _a); -var _a; diff --git a/tests/baselines/reference/destructuringAssignmentWithExportedName.js b/tests/baselines/reference/destructuringAssignmentWithExportedName.js index a23bec7b5d8..81f38a383ab 100644 --- a/tests/baselines/reference/destructuringAssignmentWithExportedName.js +++ b/tests/baselines/reference/destructuringAssignmentWithExportedName.js @@ -26,6 +26,7 @@ export { nonexportedFoo }; export { exportedFoo as foo, nonexportedFoo as nfoo }; //// [destructuringAssignmentWithExportedName.js] +var _a, _b, _c, _d, _e; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.foo = exports.exportedFoo; @@ -50,4 +51,3 @@ else if (null) { else { (_e = null[0], exports.foo = exports.exportedFoo = _e[0], exports.nfoo = exports.nonexportedFoo = nonexportedFoo = _e[1]); } -var _a, _b, _c, _d, _e; diff --git a/tests/baselines/reference/destructuringInVariableDeclarations7.js b/tests/baselines/reference/destructuringInVariableDeclarations7.js index 82f28b09672..aabbb822523 100644 --- a/tests/baselines/reference/destructuringInVariableDeclarations7.js +++ b/tests/baselines/reference/destructuringInVariableDeclarations7.js @@ -7,9 +7,9 @@ export let { toString } = 1; //// [destructuringInVariableDeclarations7.js] System.register([], function (exports_1, context_1) { + var toString; "use strict"; var __moduleName = context_1 && context_1.id; - var toString; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/destructuringInVariableDeclarations8.js b/tests/baselines/reference/destructuringInVariableDeclarations8.js index bf4be279e78..5455061cbc3 100644 --- a/tests/baselines/reference/destructuringInVariableDeclarations8.js +++ b/tests/baselines/reference/destructuringInVariableDeclarations8.js @@ -8,9 +8,9 @@ export {}; //// [destructuringInVariableDeclarations8.js] System.register([], function (exports_1, context_1) { + var toString; "use strict"; var __moduleName = context_1 && context_1.id; - var toString; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js new file mode 100644 index 00000000000..4eb341b0561 --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.js @@ -0,0 +1,24 @@ +//// [destructuringObjectBindingPatternAndAssignment5.ts] +function a () { + let x: number; + let y: any + ({ x, ...y } = ({ } as any)); +} + + +//// [destructuringObjectBindingPatternAndAssignment5.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +function a() { + var _a; + var x; + var y; + (_a = {}, (x = _a.x, _a), y = __rest(_a, ["x"])); +} diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.symbols b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.symbols new file mode 100644 index 00000000000..9769a26fc99 --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment5.ts === +function a () { +>a : Symbol(a, Decl(destructuringObjectBindingPatternAndAssignment5.ts, 0, 0)) + + let x: number; +>x : Symbol(x, Decl(destructuringObjectBindingPatternAndAssignment5.ts, 1, 7)) + + let y: any +>y : Symbol(y, Decl(destructuringObjectBindingPatternAndAssignment5.ts, 2, 7)) + + ({ x, ...y } = ({ } as any)); +>x : Symbol(x, Decl(destructuringObjectBindingPatternAndAssignment5.ts, 3, 6)) +>y : Symbol(y, Decl(destructuringObjectBindingPatternAndAssignment5.ts, 2, 7)) +} + diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.types b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.types new file mode 100644 index 00000000000..20c42266cba --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment5.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment5.ts === +function a () { +>a : () => void + + let x: number; +>x : number + + let y: any +>y : any + + ({ x, ...y } = ({ } as any)); +>({ x, ...y } = ({ } as any)) : any +>{ x, ...y } = ({ } as any) : any +>{ x, ...y } : any +>x : number +>y : any +>({ } as any) : any +>{ } as any : any +>{ } : {} +} + diff --git a/tests/baselines/reference/destructuringReassignsRightHandSide.js b/tests/baselines/reference/destructuringReassignsRightHandSide.js index bf24fa937b1..0e5cccff64d 100644 --- a/tests/baselines/reference/destructuringReassignsRightHandSide.js +++ b/tests/baselines/reference/destructuringReassignsRightHandSide.js @@ -9,10 +9,10 @@ var bar: any; var { foo, baz } = foo; //// [destructuringReassignsRightHandSide.js] +var _a; var foo = { foo: 1, bar: 2 }; var bar; // reassignment in destructuring pattern -(_b = foo, foo = _b.foo, bar = _b.bar); +(_a = foo, foo = _a.foo, bar = _a.bar); // reassignment in subsequent var -var _a = foo, foo = _a.foo, baz = _a.baz; -var _b; +var _b = foo, foo = _b.foo, baz = _b.baz; diff --git a/tests/baselines/reference/dottedNamesInSystem.js b/tests/baselines/reference/dottedNamesInSystem.js index 257d7e616af..c2a5f7e882a 100644 --- a/tests/baselines/reference/dottedNamesInSystem.js +++ b/tests/baselines/reference/dottedNamesInSystem.js @@ -9,13 +9,13 @@ export function bar() { //// [dottedNamesInSystem.js] System.register([], function (exports_1, context_1) { + var A; "use strict"; var __moduleName = context_1 && context_1.id; function bar() { return A.B.C.foo(); } exports_1("bar", bar); - var A; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/dynamicImportWithNestedThis_es2015.js b/tests/baselines/reference/dynamicImportWithNestedThis_es2015.js index 4f79e0caec1..cace97fcc2e 100644 --- a/tests/baselines/reference/dynamicImportWithNestedThis_es2015.js +++ b/tests/baselines/reference/dynamicImportWithNestedThis_es2015.js @@ -29,8 +29,8 @@ c.dynamic(); this._path = './other'; } dynamic() { - return _a = this._path, __syncRequire ? Promise.resolve().then(() => require(_a)) : new Promise((resolve_1, reject_1) => { require([_a], resolve_1, reject_1); }); var _a; + return _a = this._path, __syncRequire ? Promise.resolve().then(() => require(_a)) : new Promise((resolve_1, reject_1) => { require([_a], resolve_1, reject_1); }); } } const c = new C(); diff --git a/tests/baselines/reference/dynamicImportWithNestedThis_es5.js b/tests/baselines/reference/dynamicImportWithNestedThis_es5.js index fcfde9e9887..39fa9fea4a7 100644 --- a/tests/baselines/reference/dynamicImportWithNestedThis_es5.js +++ b/tests/baselines/reference/dynamicImportWithNestedThis_es5.js @@ -29,9 +29,9 @@ c.dynamic(); this._path = './other'; } C.prototype.dynamic = function () { + var _a; var _this = this; return _a = this._path, __syncRequire ? Promise.resolve().then(function () { return require(_a); }) : new Promise(function (resolve_1, reject_1) { require([_a], resolve_1, reject_1); }); - var _a; }; return C; }()); diff --git a/tests/baselines/reference/dynamicNames.types b/tests/baselines/reference/dynamicNames.types index 8535d7454a1..174aff77424 100644 --- a/tests/baselines/reference/dynamicNames.types +++ b/tests/baselines/reference/dynamicNames.types @@ -213,7 +213,7 @@ declare class T10 extends T9 { >T9 : T9 } declare type T11 = { ->T11 : { [c4]: number; [c5]: string; [s2]: boolean; } +>T11 : T11 [c4]: number; >[c4] : number @@ -261,7 +261,7 @@ declare class T14 extends T13 { >T13 : T13 } declare type T15 = { ->T15 : { a: number; 1: string; [s2]: boolean; } +>T15 : T15 a: number; >a : number @@ -341,9 +341,9 @@ let t6: N.T6; >T6 : N.T6 let t7: N.T7; ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >N : any ->T7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>T7 : N.T7 let t8: T8; >t8 : T8 @@ -358,8 +358,8 @@ let t10: T10; >T10 : T10 let t11: T11; ->t11 : { [c4]: number; [c5]: string; [s2]: boolean; } ->T11 : { [c4]: number; [c5]: string; [s2]: boolean; } +>t11 : T11 +>T11 : T11 let t12: T12; >t12 : T12 @@ -374,8 +374,8 @@ let t14: T14; >T14 : T14 let t15: T15; ->t15 : { a: number; 1: string; [s2]: boolean; } ->T15 : { a: number; 1: string; [s2]: boolean; } +>t15 : T15 +>T15 : T15 // assignability t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2; @@ -431,13 +431,13 @@ t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6 : N.T6 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5 : N.T5 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4 : N.T4 ->t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7 : N.T7 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5 : N.T5 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4 : N.T4 ->t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7 : N.T7 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6 : N.T6 >t4 = t5, t4 = t6, t4 = t7, t5 = t4 : N.T4 ->t4 = t5, t4 = t6, t4 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t5, t4 = t6, t4 = t7 : N.T7 >t4 = t5, t4 = t6 : N.T6 >t4 = t5 : N.T5 >t4 : N.T4 @@ -445,35 +445,35 @@ t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, >t4 = t6 : N.T6 >t4 : N.T4 >t6 : N.T6 ->t4 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t7 : N.T7 >t4 : N.T4 ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >t5 = t4 : N.T4 >t5 : N.T5 >t4 : N.T4 >t5 = t6 : N.T6 >t5 : N.T5 >t6 : N.T6 ->t5 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t5 = t7 : N.T7 >t5 : N.T5 ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >t6 = t4 : N.T4 >t6 : N.T6 >t4 : N.T4 >t6 = t5 : N.T5 >t6 : N.T6 >t5 : N.T5 ->t6 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t6 = t7 : N.T7 >t6 : N.T6 ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >t7 = t4 : N.T4 ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >t4 : N.T4 >t7 = t5 : N.T5 ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >t5 : N.T5 >t7 = t6 : N.T6 ->t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 : N.T7 >t6 : N.T6 t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; @@ -481,7 +481,7 @@ t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; >t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0 : T0 >t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0 : T0 >t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0 : T0 ->t0 = t12, t0 = t13, t0 = t14, t0 = t15 : { a: number; 1: string; [s2]: boolean; } +>t0 = t12, t0 = t13, t0 = t14, t0 = t15 : T15 >t0 = t12, t0 = t13, t0 = t14 : T14 >t0 = t12, t0 = t13 : T13 >t0 = t12 : T12 @@ -493,9 +493,9 @@ t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; >t0 = t14 : T14 >t0 : T0 >t14 : T14 ->t0 = t15 : { a: number; 1: string; [s2]: boolean; } +>t0 = t15 : T15 >t0 : T0 ->t15 : { a: number; 1: string; [s2]: boolean; } +>t15 : T15 >t12 = t0 : T0 >t12 : T12 >t0 : T0 @@ -506,7 +506,7 @@ t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; >t14 : T14 >t0 : T0 >t15 = t0 : T0 ->t15 : { a: number; 1: string; [s2]: boolean; } +>t15 : T15 >t0 : T0 t0 = C; // static side diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile.js index 53fead2d987..cc8848a1a20 100644 --- a/tests/baselines/reference/emitClassExpressionInDeclarationFile.js +++ b/tests/baselines/reference/emitClassExpressionInDeclarationFile.js @@ -130,3 +130,4 @@ declare const Test_base: { } & typeof FooItem; export declare class Test extends Test_base { } +export {}; diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js index 3f7c5c6eb75..8ef0f902778 100644 --- a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js +++ b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js @@ -42,6 +42,7 @@ var __extends = (this && this.__extends) || (function () { }; })(); exports.__esModule = true; +var _a; exports.noPrivates = (_a = /** @class */ (function () { function class_1() { this.p = 12; @@ -84,4 +85,3 @@ exports.Test = Test; var test = new Test(); Test.getTags(); test.tags(); -var _a; diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS1.js b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS1.js index af13c31ab75..e97825c7c6f 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS1.js +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS1.js @@ -16,6 +16,7 @@ var j0 = 0, j1 = 1; array3[j0++] **= array3[j1++] **= array3[j0++] **= 1; //// [emitCompoundExponentiationAssignmentWithIndexingOnLHS1.js] +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; var array0 = [1, 2, 3]; var i0 = 0; (_a = array0)[_b = ++i0] = Math.pow(_a[_b], 2); @@ -28,4 +29,3 @@ var i2 = 0; var array3 = [2, 2, 3]; var j0 = 0, j1 = 1; (_o = array3)[_p = j0++] = Math.pow(_o[_p], (_l = array3)[_m = j1++] = Math.pow(_l[_m], (_j = array3)[_k = j0++] = Math.pow(_j[_k], 1))); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS2.js b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS2.js index 37da00f81ce..04f550a0484 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS2.js +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS2.js @@ -12,6 +12,7 @@ foo()[0] **= foo()[0] ** 2; var result_foo3 = foo()[0] **= foo()[0] ** 2; //// [emitCompoundExponentiationAssignmentWithIndexingOnLHS2.js] +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; var globalCounter = 0; function foo() { globalCounter += 1; @@ -23,4 +24,3 @@ var result_foo1 = (_c = foo())[_d = 0] = Math.pow(_c[_d], foo()[0]); var result_foo2 = (_l = foo())[_m = 0] = Math.pow(_l[_m], (_j = foo())[_k = 0] = Math.pow(_j[_k], 2)); (_o = foo())[_p = 0] = Math.pow(_o[_p], Math.pow(foo()[0], 2)); var result_foo3 = (_q = foo())[_r = 0] = Math.pow(_q[_r], Math.pow(foo()[0], 2)); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.js b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.js index 6d09af018f1..f12ded9c375 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.js +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.js @@ -13,6 +13,7 @@ object[0] **= object[0] **= 2; object[0] **= object[0] ** 2; //// [emitCompoundExponentiationAssignmentWithIndexingOnLHS3.js] +var _a, _b, _c, _d, _e, _f, _g, _h; var object = { _0: 2, get 0() { @@ -25,4 +26,3 @@ var object = { (_a = object)[_b = 0] = Math.pow(_a[_b], object[0]); (_e = object)[_f = 0] = Math.pow(_e[_f], (_c = object)[_d = 0] = Math.pow(_c[_d], 2)); (_g = object)[_h = 0] = Math.pow(_g[_h], Math.pow(object[0], 2)); -var _a, _b, _c, _d, _e, _f, _g, _h; diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS4.js b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS4.js index 759dac3c194..119049235f3 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS4.js +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS4.js @@ -15,6 +15,7 @@ array1[incrementIdx(array1.length)] **= array1[incrementIdx(array1.length)] **= array1[incrementIdx(array1.length)] **= array1[incrementIdx(array1.length)] ** 2; //// [emitCompoundExponentiationAssignmentWithIndexingOnLHS4.js] +var _a, _b, _c, _d, _e, _f, _g, _h; var globalCounter = 0; function incrementIdx(max) { globalCounter += 1; @@ -25,4 +26,3 @@ var array1 = [1, 2, 3, 4, 5]; (_a = array1)[_b = incrementIdx(array1.length)] = Math.pow(_a[_b], 3); (_e = array1)[_f = incrementIdx(array1.length)] = Math.pow(_e[_f], (_c = array1)[_d = incrementIdx(array1.length)] = Math.pow(_c[_d], 2)); (_g = array1)[_h = incrementIdx(array1.length)] = Math.pow(_g[_h], Math.pow(array1[incrementIdx(array1.length)], 2)); -var _a, _b, _c, _d, _e, _f, _g, _h; diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithPropertyAccessingOnLHS1.js b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithPropertyAccessingOnLHS1.js index 9754f0163c2..82101e32835 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithPropertyAccessingOnLHS1.js +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithPropertyAccessingOnLHS1.js @@ -12,6 +12,7 @@ foo().prop **= foo().prop ** 2; var result2 = foo().prop **= foo().prop ** 2; //// [emitCompoundExponentiationAssignmentWithPropertyAccessingOnLHS1.js] +var _a, _b, _c, _d, _e, _f, _g, _h; var globalCounter = 0; function foo() { globalCounter += 1; @@ -23,4 +24,3 @@ var result0 = (_b = foo()).prop = Math.pow(_b.prop, 2); var result1 = (_f = foo()).prop = Math.pow(_f.prop, (_e = foo()).prop = Math.pow(_e.prop, 2)); (_g = foo()).prop = Math.pow(_g.prop, Math.pow(foo().prop, 2)); var result2 = (_h = foo()).prop = Math.pow(_h.prop, Math.pow(foo().prop, 2)); -var _a, _b, _c, _d, _e, _f, _g, _h; diff --git a/tests/baselines/reference/emitter.forAwait.es2015.js b/tests/baselines/reference/emitter.forAwait.es2015.js index 980dc3a8e3b..62728018e6a 100644 --- a/tests/baselines/reference/emitter.forAwait.es2015.js +++ b/tests/baselines/reference/emitter.forAwait.es2015.js @@ -57,6 +57,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; function f1() { return __awaiter(this, void 0, void 0, function* () { + var e_1, _a; let y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -70,7 +71,6 @@ function f1() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file2.js] @@ -89,6 +89,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; function f2() { return __awaiter(this, void 0, void 0, function* () { + var e_1, _a; let x, y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -102,7 +103,6 @@ function f2() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file3.js] @@ -125,6 +125,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f3() { return __asyncGenerator(this, arguments, function* f3_1() { + var e_1, _a; let y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) { @@ -138,7 +139,6 @@ function f3() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file4.js] @@ -161,6 +161,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f4() { return __asyncGenerator(this, arguments, function* f4_1() { + var e_1, _a; let x, y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) { @@ -174,7 +175,6 @@ function f4() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file5.js] @@ -194,6 +194,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { // https://github.com/Microsoft/TypeScript/issues/21363 function f5() { return __awaiter(this, void 0, void 0, function* () { + var e_1, _a; let y; try { outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -208,7 +209,6 @@ function f5() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file6.js] @@ -232,6 +232,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar // https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return __asyncGenerator(this, arguments, function* f6_1() { + var e_1, _a; let y; try { outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) { @@ -246,6 +247,5 @@ function f6() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } diff --git a/tests/baselines/reference/emitter.forAwait.es2017.js b/tests/baselines/reference/emitter.forAwait.es2017.js index 9fcf6190990..2ef0812fad4 100644 --- a/tests/baselines/reference/emitter.forAwait.es2017.js +++ b/tests/baselines/reference/emitter.forAwait.es2017.js @@ -48,6 +48,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); }; async function f1() { + var e_1, _a; let y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = await y_1.next(), !y_1_1.done;) { @@ -61,7 +62,6 @@ async function f1() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; } //// [file2.js] var __asyncValues = (this && this.__asyncValues) || function (o) { @@ -70,6 +70,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); }; async function f2() { + var e_1, _a; let x, y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = await y_1.next(), !y_1_1.done;) { @@ -83,7 +84,6 @@ async function f2() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; } //// [file3.js] var __asyncValues = (this && this.__asyncValues) || function (o) { @@ -105,6 +105,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f3() { return __asyncGenerator(this, arguments, function* f3_1() { + var e_1, _a; let y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) { @@ -118,7 +119,6 @@ function f3() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file4.js] @@ -141,6 +141,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f4() { return __asyncGenerator(this, arguments, function* f4_1() { + var e_1, _a; let x, y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) { @@ -154,7 +155,6 @@ function f4() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } //// [file5.js] @@ -165,6 +165,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; // https://github.com/Microsoft/TypeScript/issues/21363 async function f5() { + var e_1, _a; let y; try { outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = await y_1.next(), !y_1_1.done;) { @@ -179,7 +180,6 @@ async function f5() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; } //// [file6.js] var __asyncValues = (this && this.__asyncValues) || function (o) { @@ -202,6 +202,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar // https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return __asyncGenerator(this, arguments, function* f6_1() { + var e_1, _a; let y; try { outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield __await(y_1.next()), !y_1_1.done;) { @@ -216,6 +217,5 @@ function f6() { } finally { if (e_1) throw e_1.error; } } - var e_1, _a; }); } diff --git a/tests/baselines/reference/emitter.forAwait.es5.js b/tests/baselines/reference/emitter.forAwait.es5.js index 277bc2b4e6b..ec03fdb1e27 100644 --- a/tests/baselines/reference/emitter.forAwait.es5.js +++ b/tests/baselines/reference/emitter.forAwait.es5.js @@ -84,7 +84,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; function f1() { return __awaiter(this, void 0, void 0, function () { - var y, y_1, y_1_1, x, e_1_1, e_1, _a; + var e_1, _a, y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -164,7 +164,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; function f2() { return __awaiter(this, void 0, void 0, function () { - var x, y, y_1, y_1_1, e_1_1, e_1, _a; + var e_1, _a, x, y, y_1, y_1_1, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -248,7 +248,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f3() { return __asyncGenerator(this, arguments, function f3_1() { - var y, y_1, y_1_1, x, e_1_1, e_1, _a; + var e_1, _a, y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -333,7 +333,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f4() { return __asyncGenerator(this, arguments, function f4_1() { - var x, y, y_1, y_1_1, e_1_1, e_1, _a; + var e_1, _a, x, y, y_1, y_1_1, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -415,7 +415,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { // https://github.com/Microsoft/TypeScript/issues/21363 function f5() { return __awaiter(this, void 0, void 0, function () { - var y, y_1, y_1_1, x, e_1_1, e_1, _a; + var e_1, _a, y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -500,7 +500,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar // https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return __asyncGenerator(this, arguments, function f6_1() { - var y, y_1, y_1_1, x, e_1_1, e_1, _a; + var e_1, _a, y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js index bcd57cff25c..c16a385691d 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js @@ -22,11 +22,11 @@ var __read = (this && this.__read) || function (o, n) { } return ar; }; +var _a; var a; var x, y, z, a1, a2, a3; (x = a.x, y = a.y, z = a.z); (_a = __read(a, 3), a1 = _a[0], a2 = _a[1], a3 = _a[2]); -var _a; //// [emptyAssignmentPatterns02_ES5iterable.d.ts] diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js index 36c124be511..dfcd7a80f62 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js @@ -22,11 +22,11 @@ var __read = (this && this.__read) || function (o, n) { } return ar; }; +var _a; var a; var x, y, z, a1, a2, a3; (x = a.x, y = a.y, z = a.z); (_a = __read(a, 3), a1 = _a[0], a2 = _a[1], a3 = _a[2]); -var _a; //// [emptyAssignmentPatterns04_ES5iterable.d.ts] diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js index 09d4cb8972b..80b2b04b8f0 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js @@ -104,78 +104,78 @@ var __values = (this && this.__values) || function (o) { } })(); (function () { + var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f; var ns = []; try { for (var ns_1 = __values(ns), ns_1_1 = ns_1.next(); !ns_1_1.done; ns_1_1 = ns_1.next()) { - var _a = ns_1_1.value; + var _g = ns_1_1.value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { - if (ns_1_1 && !ns_1_1.done && (_g = ns_1.return)) _g.call(ns_1); + if (ns_1_1 && !ns_1_1.done && (_a = ns_1.return)) _a.call(ns_1); } finally { if (e_1) throw e_1.error; } } try { for (var ns_2 = __values(ns), ns_2_1 = ns_2.next(); !ns_2_1.done; ns_2_1 = ns_2.next()) { - var _b = ns_2_1.value; + var _h = ns_2_1.value; } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { - if (ns_2_1 && !ns_2_1.done && (_h = ns_2.return)) _h.call(ns_2); + if (ns_2_1 && !ns_2_1.done && (_b = ns_2.return)) _b.call(ns_2); } finally { if (e_2) throw e_2.error; } } try { for (var ns_3 = __values(ns), ns_3_1 = ns_3.next(); !ns_3_1.done; ns_3_1 = ns_3.next()) { - var _c = ns_3_1.value; + var _j = ns_3_1.value; } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { - if (ns_3_1 && !ns_3_1.done && (_j = ns_3.return)) _j.call(ns_3); + if (ns_3_1 && !ns_3_1.done && (_c = ns_3.return)) _c.call(ns_3); } finally { if (e_3) throw e_3.error; } } try { for (var ns_4 = __values(ns), ns_4_1 = ns_4.next(); !ns_4_1.done; ns_4_1 = ns_4.next()) { - var _d = __read(ns_4_1.value, 0); + var _k = __read(ns_4_1.value, 0); } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { - if (ns_4_1 && !ns_4_1.done && (_k = ns_4.return)) _k.call(ns_4); + if (ns_4_1 && !ns_4_1.done && (_d = ns_4.return)) _d.call(ns_4); } finally { if (e_4) throw e_4.error; } } try { for (var ns_5 = __values(ns), ns_5_1 = ns_5.next(); !ns_5_1.done; ns_5_1 = ns_5.next()) { - var _e = __read(ns_5_1.value, 0); + var _l = __read(ns_5_1.value, 0); } } catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { try { - if (ns_5_1 && !ns_5_1.done && (_l = ns_5.return)) _l.call(ns_5); + if (ns_5_1 && !ns_5_1.done && (_e = ns_5.return)) _e.call(ns_5); } finally { if (e_5) throw e_5.error; } } try { for (var ns_6 = __values(ns), ns_6_1 = ns_6.next(); !ns_6_1.done; ns_6_1 = ns_6.next()) { - var _f = __read(ns_6_1.value, 0); + var _m = __read(ns_6_1.value, 0); } } catch (e_6_1) { e_6 = { error: e_6_1 }; } finally { try { - if (ns_6_1 && !ns_6_1.done && (_m = ns_6.return)) _m.call(ns_6); + if (ns_6_1 && !ns_6_1.done && (_f = ns_6.return)) _f.call(ns_6); } finally { if (e_6) throw e_6.error; } } - var e_1, _g, e_2, _h, e_3, _j, e_4, _k, e_5, _l, e_6, _m; })(); diff --git a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js index 9cf1d0098b2..5fbeef0461a 100644 --- a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js @@ -315,7 +315,7 @@ function forOfStatement10() { } function forOfStatement11() { return __awaiter(this, void 0, void 0, function () { - var _i, y_8, _a, _b; + var _a, _i, y_8, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -323,17 +323,17 @@ function forOfStatement11() { _c.label = 1; case 1: if (!(_i < y_8.length)) return [3 /*break*/, 6]; - _b = y_8[_i][0]; - if (!(_b === void 0)) return [3 /*break*/, 3]; + _a = y_8[_i][0]; + if (!(_a === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: - _a = _c.sent(); + _b = _c.sent(); return [3 /*break*/, 4]; case 3: - _a = _b; + _b = _a; _c.label = 4; case 4: - x = _a; + x = _b; z; _c.label = 5; case 5: @@ -346,18 +346,18 @@ function forOfStatement11() { } function forOfStatement12() { return __awaiter(this, void 0, void 0, function () { - var _i, _a, _b; + var _a, _i, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; return [4 /*yield*/, y]; case 1: - _a = _c.sent(); + _b = _c.sent(); _c.label = 2; case 2: - if (!(_i < _a.length)) return [3 /*break*/, 4]; - _b = _a[_i][0], x = _b === void 0 ? a : _b; + if (!(_i < _b.length)) return [3 /*break*/, 4]; + _a = _b[_i][0], x = _a === void 0 ? a : _a; z; _c.label = 3; case 3: @@ -370,7 +370,7 @@ function forOfStatement12() { } function forOfStatement13() { return __awaiter(this, void 0, void 0, function () { - var _i, y_9, _a; + var _a, _i, y_9; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -440,7 +440,7 @@ function forOfStatement15() { } function forOfStatement16() { return __awaiter(this, void 0, void 0, function () { - var _i, y_11, _a, _b; + var _a, _i, y_11, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -448,17 +448,17 @@ function forOfStatement16() { _c.label = 1; case 1: if (!(_i < y_11.length)) return [3 /*break*/, 6]; - _b = y_11[_i].x; - if (!(_b === void 0)) return [3 /*break*/, 3]; + _a = y_11[_i].x; + if (!(_a === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: - _a = _c.sent(); + _b = _c.sent(); return [3 /*break*/, 4]; case 3: - _a = _b; + _b = _a; _c.label = 4; case 4: - x = _a; + x = _b; z; _c.label = 5; case 5: @@ -471,18 +471,18 @@ function forOfStatement16() { } function forOfStatement17() { return __awaiter(this, void 0, void 0, function () { - var _i, _a, _b; + var _a, _i, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; return [4 /*yield*/, y]; case 1: - _a = _c.sent(); + _b = _c.sent(); _c.label = 2; case 2: - if (!(_i < _a.length)) return [3 /*break*/, 4]; - _b = _a[_i].x, x = _b === void 0 ? a : _b; + if (!(_i < _b.length)) return [3 /*break*/, 4]; + _a = _b[_i].x, x = _a === void 0 ? a : _a; z; _c.label = 3; case 3: @@ -495,7 +495,7 @@ function forOfStatement17() { } function forOfStatement18() { return __awaiter(this, void 0, void 0, function () { - var _i, y_12, _a; + var _a, _i, y_12; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js index 8bc90935d37..de1aab50b51 100644 --- a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js +++ b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js @@ -109,13 +109,13 @@ function objectLiteral3() { return __generator(this, function (_c) { switch (_c.label) { case 0: - _b = {}; - _a = a; + _a = {}; + _b = a; return [4 /*yield*/, y]; case 1: - x = (_b[_a] = _c.sent(), - _b.b = z, - _b); + x = (_a[_b] = _c.sent(), + _a.b = z, + _a); return [2 /*return*/]; } }); @@ -162,14 +162,14 @@ function objectLiteral6() { return __generator(this, function (_c) { switch (_c.label) { case 0: - _b = { + _a = { a: y }; - _a = b; + _b = b; return [4 /*yield*/, z]; case 1: - x = (_b[_a] = _c.sent(), - _b); + x = (_a[_b] = _c.sent(), + _a); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/es5-system.js b/tests/baselines/reference/es5-system.js index a46fc19455a..c84b5c9e631 100644 --- a/tests/baselines/reference/es5-system.js +++ b/tests/baselines/reference/es5-system.js @@ -15,9 +15,9 @@ export default class A //// [es5-system.js] System.register([], function (exports_1, context_1) { + var A; "use strict"; var __moduleName = context_1 && context_1.id; - var A; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/es5-system2.js b/tests/baselines/reference/es5-system2.js index 4d793326b9b..bb697216628 100644 --- a/tests/baselines/reference/es5-system2.js +++ b/tests/baselines/reference/es5-system2.js @@ -3,9 +3,9 @@ export var __esModule = 1; //// [es5-system2.js] System.register([], function (exports_1, context_1) { + var __esModule; "use strict"; var __moduleName = context_1 && context_1.id; - var __esModule; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/es6modulekindWithES5Target11.js b/tests/baselines/reference/es6modulekindWithES5Target11.js index 67cee76f741..c720e4740d5 100644 --- a/tests/baselines/reference/es6modulekindWithES5Target11.js +++ b/tests/baselines/reference/es6modulekindWithES5Target11.js @@ -22,11 +22,11 @@ var C = /** @class */ (function () { C_1 = C; C.x = function () { return C_1.y; }; C.prototype.method = function () { }; + var C_1; C.y = 1; C = C_1 = __decorate([ foo ], C); return C; - var C_1; }()); export default C; diff --git a/tests/baselines/reference/esnextmodulekindWithES5Target11.js b/tests/baselines/reference/esnextmodulekindWithES5Target11.js index 58b18c4e829..a32ac998065 100644 --- a/tests/baselines/reference/esnextmodulekindWithES5Target11.js +++ b/tests/baselines/reference/esnextmodulekindWithES5Target11.js @@ -22,11 +22,11 @@ var C = /** @class */ (function () { C_1 = C; C.x = function () { return C_1.y; }; C.prototype.method = function () { }; + var C_1; C.y = 1; C = C_1 = __decorate([ foo ], C); return C; - var C_1; }()); export default C; diff --git a/tests/baselines/reference/exportClassExtendingIntersection.js b/tests/baselines/reference/exportClassExtendingIntersection.js index 9b99e90d511..70ea0b3b53a 100644 --- a/tests/baselines/reference/exportClassExtendingIntersection.js +++ b/tests/baselines/reference/exportClassExtendingIntersection.js @@ -118,5 +118,6 @@ declare const MyExtendedClass_base: typeof MyBaseClass & (new (...args: any[]) = export declare class MyExtendedClass extends MyExtendedClass_base { extendedClassProperty: number; } +export {}; //// [Main.d.ts] export {}; diff --git a/tests/baselines/reference/exportDefaultParenthesize.js b/tests/baselines/reference/exportDefaultParenthesize.js index 31fe9b6da3e..aa057a091bd 100644 --- a/tests/baselines/reference/exportDefaultParenthesize.js +++ b/tests/baselines/reference/exportDefaultParenthesize.js @@ -37,6 +37,7 @@ export default () => 42; //// [commalist.js] +var _a; export default (_a = {}, _a['foo' + ''] = 42, _a['foo' + ''] = 42, @@ -62,11 +63,10 @@ export default (_a = {}, _a['foo' + ''] = 42, _a['foo' + ''] = 42, _a); -var _a; //// [comma.js] +var _a; export default (_a = {}, _a['foo'] = 42, _a); -var _a; //// [functionexpression.js] export default (function () { return 42; }); diff --git a/tests/baselines/reference/exportNonInitializedVariablesSystem.js b/tests/baselines/reference/exportNonInitializedVariablesSystem.js index 7755cb4fc36..56d27bfbead 100644 --- a/tests/baselines/reference/exportNonInitializedVariablesSystem.js +++ b/tests/baselines/reference/exportNonInitializedVariablesSystem.js @@ -35,9 +35,9 @@ export let h1: D = new D; //// [exportNonInitializedVariablesSystem.js] System.register([], function (exports_1, context_1) { + var a, b, c, d, A, e, f, B, C, a1, b1, c1, d1, D, e1, f1, g1, h1; "use strict"; var __moduleName = context_1 && context_1.id; - var a, b, c, d, A, e, f, B, C, a1, b1, c1, d1, D, e1, f1, g1, h1; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js index e4314c4f7fd..249a633cd07 100644 --- a/tests/baselines/reference/exportStarForValues10.js +++ b/tests/baselines/reference/exportStarForValues10.js @@ -13,9 +13,9 @@ var x = 1; //// [file0.js] System.register([], function (exports_1, context_1) { + var v; "use strict"; var __moduleName = context_1 && context_1.id; - var v; return { setters: [], execute: function () { @@ -35,9 +35,9 @@ System.register([], function (exports_1, context_1) { }); //// [file2.js] System.register(["file0"], function (exports_1, context_1) { + var x; "use strict"; var __moduleName = context_1 && context_1.id; - var x; function exportStar_1(m) { var exports = {}; for (var n in m) { diff --git a/tests/baselines/reference/exportStarForValues6.js b/tests/baselines/reference/exportStarForValues6.js index 15c2324d205..8bf7e91c87a 100644 --- a/tests/baselines/reference/exportStarForValues6.js +++ b/tests/baselines/reference/exportStarForValues6.js @@ -19,9 +19,9 @@ System.register([], function (exports_1, context_1) { }); //// [file2.js] System.register([], function (exports_1, context_1) { + var x; "use strict"; var __moduleName = context_1 && context_1.id; - var x; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/exportStarForValuesInSystem.js b/tests/baselines/reference/exportStarForValuesInSystem.js index 8cd96011199..d5f9c5bac2c 100644 --- a/tests/baselines/reference/exportStarForValuesInSystem.js +++ b/tests/baselines/reference/exportStarForValuesInSystem.js @@ -19,9 +19,9 @@ System.register([], function (exports_1, context_1) { }); //// [file2.js] System.register([], function (exports_1, context_1) { + var x; "use strict"; var __moduleName = context_1 && context_1.id; - var x; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline index e21f677a7ea..d2b26ca48c8 100644 --- a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline @@ -1,6 +1,4 @@ -EmitSkipped: true -Diagnostics: - Exported variable 'foo' has or is using private name 'C'. +EmitSkipped: false FileName : /tests/cases/fourslash/inputFile.js var M; (function (M) { @@ -11,4 +9,10 @@ var M; }()); M.foo = new C(); })(M || (M = {})); +FileName : /tests/cases/fourslash/inputFile.d.ts +declare module M { + class C { + } + var foo: C; +} diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline index 5cc4df243d0..77131f89dd5 100644 --- a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline @@ -1,6 +1,4 @@ -EmitSkipped: true -Diagnostics: - Exported variable 'foo' has or is using private name 'C'. +EmitSkipped: false FileName : /tests/cases/fourslash/inputFile.js define(["require", "exports"], function (require, exports) { "use strict"; @@ -15,4 +13,11 @@ define(["require", "exports"], function (require, exports) { M.foo = new C(); })(M = exports.M || (exports.M = {})); }); +FileName : /tests/cases/fourslash/inputFile.d.ts +class C { +} +export declare module M { + var foo: C; +} +export {}; diff --git a/tests/baselines/reference/importCallExpressionAsyncES3System.js b/tests/baselines/reference/importCallExpressionAsyncES3System.js index c55d8788c98..7f9814e7e96 100644 --- a/tests/baselines/reference/importCallExpressionAsyncES3System.js +++ b/tests/baselines/reference/importCallExpressionAsyncES3System.js @@ -30,7 +30,6 @@ export const l = async () => { //// [test.js] System.register([], function (exports_1, context_1) { - "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -66,6 +65,8 @@ System.register([], function (exports_1, context_1) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; + var _this, cl1, obj, cl2, l; + "use strict"; _this = this; var __moduleName = context_1 && context_1.id; function fn() { @@ -83,7 +84,6 @@ System.register([], function (exports_1, context_1) { }); } exports_1("fn", fn); - var _this, cl1, obj, cl2, l; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionAsyncES5System.js b/tests/baselines/reference/importCallExpressionAsyncES5System.js index b9fad574550..2a3c3629f1b 100644 --- a/tests/baselines/reference/importCallExpressionAsyncES5System.js +++ b/tests/baselines/reference/importCallExpressionAsyncES5System.js @@ -30,7 +30,6 @@ export const l = async () => { //// [test.js] System.register([], function (exports_1, context_1) { - "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -66,6 +65,8 @@ System.register([], function (exports_1, context_1) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; + var _this, cl1, obj, cl2, l; + "use strict"; _this = this; var __moduleName = context_1 && context_1.id; function fn() { @@ -83,7 +84,6 @@ System.register([], function (exports_1, context_1) { }); } exports_1("fn", fn); - var _this, cl1, obj, cl2, l; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionAsyncES6System.js b/tests/baselines/reference/importCallExpressionAsyncES6System.js index 32a9b9028e5..ed771dbb4c0 100644 --- a/tests/baselines/reference/importCallExpressionAsyncES6System.js +++ b/tests/baselines/reference/importCallExpressionAsyncES6System.js @@ -30,7 +30,6 @@ export const l = async () => { //// [test.js] System.register([], function (exports_1, context_1) { - "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -39,6 +38,8 @@ System.register([], function (exports_1, context_1) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; + var cl1, obj, cl2, l; + "use strict"; var __moduleName = context_1 && context_1.id; function fn() { return __awaiter(this, void 0, void 0, function* () { @@ -46,7 +47,6 @@ System.register([], function (exports_1, context_1) { }); } exports_1("fn", fn); - var cl1, obj, cl2, l; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionES5System.js b/tests/baselines/reference/importCallExpressionES5System.js index def99752bb1..69c005df3bd 100644 --- a/tests/baselines/reference/importCallExpressionES5System.js +++ b/tests/baselines/reference/importCallExpressionES5System.js @@ -42,12 +42,12 @@ System.register([], function (exports_1, context_1) { }); //// [1.js] System.register([], function (exports_1, context_1) { + var p1, p2, C, D; "use strict"; var __moduleName = context_1 && context_1.id; function foo() { var p2 = context_1.import("./0"); } - var p1, p2, C, D; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionES6System.js b/tests/baselines/reference/importCallExpressionES6System.js index 0676e4cd559..abf8ff507ed 100644 --- a/tests/baselines/reference/importCallExpressionES6System.js +++ b/tests/baselines/reference/importCallExpressionES6System.js @@ -42,12 +42,12 @@ System.register([], function (exports_1, context_1) { }); //// [1.js] System.register([], function (exports_1, context_1) { + var p1, p2, C, D; "use strict"; var __moduleName = context_1 && context_1.id; function foo() { const p2 = context_1.import("./0"); } - var p1, p2, C, D; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionInSystem1.js b/tests/baselines/reference/importCallExpressionInSystem1.js index 74df68fc9a1..237ca312b88 100644 --- a/tests/baselines/reference/importCallExpressionInSystem1.js +++ b/tests/baselines/reference/importCallExpressionInSystem1.js @@ -30,12 +30,12 @@ System.register([], function (exports_1, context_1) { }); //// [1.js] System.register([], function (exports_1, context_1) { + var p1, p2; "use strict"; var __moduleName = context_1 && context_1.id; function foo() { const p2 = context_1.import("./0"); } - var p1, p2; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionInSystem2.js b/tests/baselines/reference/importCallExpressionInSystem2.js index ea84e47e63c..b64632bc9db 100644 --- a/tests/baselines/reference/importCallExpressionInSystem2.js +++ b/tests/baselines/reference/importCallExpressionInSystem2.js @@ -18,9 +18,9 @@ foo(import("./0")); //// [0.js] System.register([], function (exports_1, context_1) { + var B; "use strict"; var __moduleName = context_1 && context_1.id; - var B; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionInSystem3.js b/tests/baselines/reference/importCallExpressionInSystem3.js index 309be9114fe..89bee947662 100644 --- a/tests/baselines/reference/importCallExpressionInSystem3.js +++ b/tests/baselines/reference/importCallExpressionInSystem3.js @@ -15,9 +15,9 @@ foo(); //// [0.js] System.register([], function (exports_1, context_1) { + var B; "use strict"; var __moduleName = context_1 && context_1.id; - var B; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionInSystem4.js b/tests/baselines/reference/importCallExpressionInSystem4.js index b7bc1f51fe5..dd2f9faadc8 100644 --- a/tests/baselines/reference/importCallExpressionInSystem4.js +++ b/tests/baselines/reference/importCallExpressionInSystem4.js @@ -42,11 +42,11 @@ export class D { //// [0.js] System.register([], function (exports_1, context_1) { + var B; "use strict"; var __moduleName = context_1 && context_1.id; function foo() { return "foo"; } exports_1("foo", foo); - var B; return { setters: [], execute: function () { @@ -71,9 +71,9 @@ System.register([], function (exports_1, context_1) { }); //// [2.js] System.register([], function (exports_1, context_1) { + var C, D; "use strict"; var __moduleName = context_1 && context_1.id; - var C, D; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/importCallExpressionNestedUMD.js b/tests/baselines/reference/importCallExpressionNestedUMD.js index 0b1d20af8a4..c61e35c3399 100644 --- a/tests/baselines/reference/importCallExpressionNestedUMD.js +++ b/tests/baselines/reference/importCallExpressionNestedUMD.js @@ -44,8 +44,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge var __syncRequire = typeof module === "object" && typeof module.exports === "object"; function foo() { return __awaiter(this, void 0, void 0, function* () { - return yield _a = (yield __syncRequire ? Promise.resolve().then(() => require("./foo")) : new Promise((resolve_1, reject_1) => { require(["./foo"], resolve_1, reject_1); })).default, __syncRequire ? Promise.resolve().then(() => require(_a)) : new Promise((resolve_2, reject_2) => { require([_a], resolve_2, reject_2); }); var _a; + return yield _a = (yield __syncRequire ? Promise.resolve().then(() => require("./foo")) : new Promise((resolve_1, reject_1) => { require(["./foo"], resolve_1, reject_1); })).default, __syncRequire ? Promise.resolve().then(() => require(_a)) : new Promise((resolve_2, reject_2) => { require([_a], resolve_2, reject_2); }); }); } }); diff --git a/tests/baselines/reference/importCallExpressionNestedUMD2.js b/tests/baselines/reference/importCallExpressionNestedUMD2.js index 86fd0bfa8f1..aba25f20d31 100644 --- a/tests/baselines/reference/importCallExpressionNestedUMD2.js +++ b/tests/baselines/reference/importCallExpressionNestedUMD2.js @@ -72,12 +72,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function foo() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + var _b; switch (_a.label) { case 0: return [4 /*yield*/, __syncRequire ? Promise.resolve().then(function () { return require("./foo"); }) : new Promise(function (resolve_1, reject_1) { require(["./foo"], resolve_1, reject_1); })]; case 1: return [4 /*yield*/, (_b = (_a.sent()).default, __syncRequire ? Promise.resolve().then(function () { return require(_b); }) : new Promise(function (resolve_2, reject_2) { require([_b], resolve_2, reject_2); }))]; case 2: return [2 /*return*/, _a.sent()]; } - var _b; }); }); } diff --git a/tests/baselines/reference/importHelpersSystem.js b/tests/baselines/reference/importHelpersSystem.js index 9392833f6f4..6e29369b842 100644 --- a/tests/baselines/reference/importHelpersSystem.js +++ b/tests/baselines/reference/importHelpersSystem.js @@ -19,9 +19,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge //// [a.js] System.register([], function (exports_1, context_1) { + var A; "use strict"; var __moduleName = context_1 && context_1.id; - var A; return { setters: [], execute: function () { @@ -36,9 +36,9 @@ System.register([], function (exports_1, context_1) { }); //// [b.js] System.register(["tslib", "./a"], function (exports_1, context_1) { + var tslib_1, a_1, B; "use strict"; var __moduleName = context_1 && context_1.id; - var tslib_1, a_1, B; var exportedNames_1 = { "B": true }; diff --git a/tests/baselines/reference/indexedAccessTypeConstraints.types b/tests/baselines/reference/indexedAccessTypeConstraints.types index dad5fd7d617..f2002aff900 100644 --- a/tests/baselines/reference/indexedAccessTypeConstraints.types +++ b/tests/baselines/reference/indexedAccessTypeConstraints.types @@ -11,7 +11,7 @@ interface IData { } type Data = { ->Data : { get: (prop: K) => T[K]; } +>Data : Data >T : T get: (prop: K) => T[K]; @@ -30,19 +30,19 @@ class Parent { >M : M constructor(private data: Data) {} ->data : { get: (prop: K) => M[K]; } ->Data : { get: (prop: K) => T[K]; } +>data : Data +>Data : Data >M : M getData(): Data { ->getData : () => { get: (prop: K) => M[K]; } ->Data : { get: (prop: K) => T[K]; } +>getData : () => Data +>Data : Data >M : M return this.data; ->this.data : { get: (prop: K) => M[K]; } +>this.data : Data >this : this ->data : { get: (prop: K) => M[K]; } +>data : Data } } @@ -60,10 +60,10 @@ export class Foo extends Parent> { return this.getData().get('content'); >this.getData().get('content') : C >this.getData().get : (prop: K) => IData[K] ->this.getData() : { get: (prop: K) => IData[K]; } ->this.getData : () => { get: (prop: K) => IData[K]; } +>this.getData() : Data> +>this.getData : () => Data> >this : this ->getData : () => { get: (prop: K) => IData[K]; } +>getData : () => Data> >get : (prop: K) => IData[K] >'content' : "content" } @@ -85,10 +85,10 @@ export class Bar> extends Parent { return this.getData().get('content'); >this.getData().get('content') : T["content"] >this.getData().get : (prop: K) => T[K] ->this.getData() : { get: (prop: K) => T[K]; } ->this.getData : () => { get: (prop: K) => T[K]; } +>this.getData() : Data +>this.getData : () => Data >this : this ->getData : () => { get: (prop: K) => T[K]; } +>getData : () => Data >get : (prop: K) => T[K] >'content' : "content" } diff --git a/tests/baselines/reference/inferredNonidentifierTypesGetQuotes.js b/tests/baselines/reference/inferredNonidentifierTypesGetQuotes.js index e9ce8e56d1f..bcfcd9dc18d 100644 --- a/tests/baselines/reference/inferredNonidentifierTypesGetQuotes.js +++ b/tests/baselines/reference/inferredNonidentifierTypesGetQuotes.js @@ -4,9 +4,9 @@ var x = [{ "a-b": "string" }, {}]; var y = [{ ["a-b"]: "string" }, {}]; //// [inferredNonidentifierTypesGetQuotes.js] +var _a; var x = [{ "a-b": "string" }, {}]; var y = [(_a = {}, _a["a-b"] = "string", _a), {}]; -var _a; //// [inferredNonidentifierTypesGetQuotes.d.ts] diff --git a/tests/baselines/reference/invalidNewTarget.es5.js b/tests/baselines/reference/invalidNewTarget.es5.js index 54bc5ea2d64..0aaee863af1 100644 --- a/tests/baselines/reference/invalidNewTarget.es5.js +++ b/tests/baselines/reference/invalidNewTarget.es5.js @@ -25,6 +25,7 @@ const O = { }; //// [invalidNewTarget.es5.js] +var _a; var a = _newTarget; var b = function () { return _newTarget; }; var C = /** @class */ (function () { @@ -74,4 +75,3 @@ var O = (_a = {}, }), _a.n = _newTarget, _a); -var _a; diff --git a/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.js b/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.js index 8617127b40d..4a3c6fbcf06 100644 --- a/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.js +++ b/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.js @@ -8,9 +8,9 @@ import * from Zero from "./0" //// [0.js] System.register([], function (exports_1, context_1) { + var C; "use strict"; var __moduleName = context_1 && context_1.id; - var C; return { setters: [], execute: function () { @@ -25,9 +25,9 @@ System.register([], function (exports_1, context_1) { }); //// [1.js] System.register([], function (exports_1, context_1) { + var from; "use strict"; var __moduleName = context_1 && context_1.id; - var from; return { setters: [], execute: function () { diff --git a/tests/baselines/reference/jsxSpreadFirstUnionNoErrors.types b/tests/baselines/reference/jsxSpreadFirstUnionNoErrors.types index d96c88d1c41..0e97c588a64 100644 --- a/tests/baselines/reference/jsxSpreadFirstUnionNoErrors.types +++ b/tests/baselines/reference/jsxSpreadFirstUnionNoErrors.types @@ -3,7 +3,7 @@ import React from "react"; >React : typeof React type InfoProps = ->InfoProps : { status: "hidden"; } | { status: "visible"; content: string; } +>InfoProps : InfoProps | { status: "hidden" } >status : "hidden" @@ -13,16 +13,16 @@ type InfoProps = >content : string const Info = (props: InfoProps) => ->Info : (props: { status: "hidden"; } | { status: "visible"; content: string; }) => JSX.Element ->(props: InfoProps) =>props.status === "hidden" ?