diff --git a/package-lock.json b/package-lock.json index bb09ef98d..d09ef23ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/trace-agent", - "version": "2.10.0", + "version": "2.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -153,9 +153,9 @@ } }, "@google-cloud/common": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.19.1.tgz", - "integrity": "sha512-GVv8PZ/DQwrCkmx0iKJcLrjFc+Eeky1WwyQJQljrNTOJ52sxa7xTEjD3hPphFBJj56ECMl55YV5jJmezBJEFEA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.20.0.tgz", + "integrity": "sha512-OCeDhpt+Qr90GxMFi54302Maf45Nux8ymF/jXgpPNElJUsjTmSN+Vzg3WmfAY+TYG9MDL2VufjjwlM4XrcNYcw==", "requires": { "@types/duplexify": "3.5.0", "@types/request": "2.47.0", @@ -164,13 +164,14 @@ "duplexify": "3.6.0", "ent": "2.2.0", "extend": "3.0.1", - "google-auth-library": "1.5.0", + "google-auth-library": "1.6.1", "is": "3.2.1", "pify": "3.0.0", - "request": "2.85.0", + "request": "2.87.0", "retry-request": "3.3.1", "split-array-stream": "2.0.0", - "stream-events": "1.0.4" + "stream-events": "1.0.4", + "through2": "2.0.3" }, "dependencies": { "axios": { @@ -181,6 +182,47 @@ "follow-redirects": "1.4.1", "is-buffer": "1.1.6" } + }, + "google-auth-library": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-1.6.1.tgz", + "integrity": "sha512-jYiWC8NA9n9OtQM7ANn0Tk464do9yhKEtaJ72pKcaBiEwn4LwcGYIYOfwtfsSm3aur/ed3tlSxbmg24IAT6gAg==", + "requires": { + "axios": "0.18.0", + "gcp-metadata": "0.6.3", + "gtoken": "2.3.0", + "jws": "3.1.5", + "lodash.isstring": "4.0.1", + "lru-cache": "4.1.3", + "retry-axios": "0.3.2" + } + }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.7.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.2", + "safe-buffer": "5.1.2", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } } } }, @@ -262,9 +304,9 @@ "dev": true }, "@types/mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-YeDiSEzznwZwwp766SJ6QlrTyBYUGPSIwmREHVTmktUYiT/WADdWtpt9iH0KuUSf8lZLdI4lP0X6PBzPo5//JQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.1.tgz", + "integrity": "sha512-dOrgprHnkDaj1pmrwdcMAf0QRNQzqTB5rxJph+iIQshSmIvtgRqJ0nim8u1vvXU8iOXZrH96+M46JDFTPLingA==", "dev": true }, "@types/ncp": { @@ -794,12 +836,6 @@ "split2": "2.2.0" } }, - "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", - "dev": true - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -812,25 +848,6 @@ "integrity": "sha512-SK/846h/Rcy8q9Z9CAwGBLfCJ6EkjJWdpelWDufQpqVDYq2Wnnv8zlSO6AMQap02jvhVruKKpEtQOufo3pFhLg==", "dev": true }, - "clang-format": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.2.2.tgz", - "integrity": "sha512-6X9u1JBMak/9VbC0IZajEDvp19/PbjCanbRO3Z2xsluypQtbPPAGDvGGovLOWoUpXIvJH9vJExmzlqWvwItZxA==", - "dev": true, - "requires": { - "async": "1.5.2", - "glob": "7.1.2", - "resolve": "1.7.1" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - } - } - }, "cli": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", @@ -1945,17 +1962,6 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, - "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", - "dev": true, - "requires": { - "chardet": "0.4.2", - "iconv-lite": "0.4.19", - "tmp": "0.0.33" - } - }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -2490,31 +2496,6 @@ "integrity": "sha512-hYyf+kI8dm3nORsiiXUQigOU62hDLfJ9G01uyGMxhc6BKsircrUhC4uJPQPUSuq2GrTmiiEt7ewxlMdBewfmKQ==", "dev": true }, - "google-auth-library": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-1.5.0.tgz", - "integrity": "sha512-xpibA/hkq4waBcpIkSJg4GiDAqcBWjJee3c47zj7xP3RQ0A9mc8MP3Vc9sc8SGRoDYA0OszZxTjW7SbcC4pJIA==", - "requires": { - "axios": "0.18.0", - "gcp-metadata": "0.6.3", - "gtoken": "2.3.0", - "jws": "3.1.5", - "lodash.isstring": "4.0.1", - "lru-cache": "4.1.3", - "retry-axios": "0.3.2" - }, - "dependencies": { - "axios": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", - "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", - "requires": { - "follow-redirects": "1.4.1", - "is-buffer": "1.1.6" - } - } - } - }, "google-p12-pem": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.2.tgz", @@ -2579,15 +2560,15 @@ } }, "gts": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/gts/-/gts-0.5.4.tgz", - "integrity": "sha512-bDxE/NvHu+v0uW0qbUMYClrGCi81Ug4Wa7BsV/yUtdEh67C3K56BiqAk8yBOttLH1k4XYks+7QSJy7XOf3vaQw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/gts/-/gts-0.7.1.tgz", + "integrity": "sha512-7yMBk3+SmyL4+047vIXOAUWlNfbIkuPH0UnhQYzurM8yj1ufiVH++BdBpZY7AP6/wytvzq7PuVzqAXbk5isn2A==", "dev": true, "requires": { "chalk": "2.4.1", - "clang-format": "1.2.2", - "inquirer": "3.3.0", - "meow": "4.0.1", + "clang-format": "1.2.3", + "inquirer": "6.0.0", + "meow": "5.0.0", "pify": "3.0.0", "rimraf": "2.6.2", "tslint": "5.10.0", @@ -2595,6 +2576,12 @@ "write-file-atomic": "2.3.0" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -2604,6 +2591,12 @@ "color-convert": "1.9.1" } }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, "chalk": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", @@ -2615,6 +2608,90 @@ "supports-color": "5.4.0" } }, + "chardet": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.5.0.tgz", + "integrity": "sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g==", + "dev": true + }, + "clang-format": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.2.3.tgz", + "integrity": "sha512-x90Hac4ERacGDcZSvHKK58Ga0STuMD+Doi5g0iG2zf7wlJef5Huvhs/3BvMRFxwRYyYSdl6mpQNrtfMxE8MQzw==", + "dev": true, + "requires": { + "async": "1.5.2", + "glob": "7.1.2", + "resolve": "1.7.1" + } + }, + "external-editor": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.0.tgz", + "integrity": "sha512-mpkfj0FEdxrIhOC04zk85X7StNtr0yXnG7zCb+8ikO8OJi2jsHh5YGoknNTyXgsbHOf1WOOcVU3kPFWT2WgCkQ==", + "dev": true, + "requires": { + "chardet": "0.5.0", + "iconv-lite": "0.4.23", + "tmp": "0.0.33" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "inquirer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.0.0.tgz", + "integrity": "sha512-tISQWRwtcAgrz+SHPhTH7d3e73k31gsOy6i1csonLc0u1dVK/wYvuOnFeiWqC5OXFIYbmrIFInef31wbT8MEJg==", + "dev": true, + "requires": { + "ansi-escapes": "3.1.0", + "chalk": "2.4.1", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "3.0.0", + "figures": "2.0.0", + "lodash": "4.17.10", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rxjs": "6.2.1", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, + "meow": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", + "dev": true, + "requires": { + "camelcase-keys": "4.2.0", + "decamelize-keys": "1.1.0", + "loud-rejection": "1.6.0", + "minimist-options": "3.0.2", + "normalize-package-data": "2.4.0", + "read-pkg-up": "3.0.0", + "redent": "2.0.0", + "trim-newlines": "2.0.0", + "yargs-parser": "10.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -2623,6 +2700,15 @@ "requires": { "has-flag": "3.0.0" } + }, + "yargs-parser": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.0.0.tgz", + "integrity": "sha512-+DHejWujTVYeMHLff8U96rLc4uE4Emncoftvn5AjhB1Jw1pWxLzgBUT/WYbPrHmy6YPEBTZQx5myHhVcuuu64g==", + "dev": true, + "requires": { + "camelcase": "4.1.0" + } } } }, @@ -2864,74 +2950,6 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, - "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", - "dev": true, - "requires": { - "ansi-escapes": "3.1.0", - "chalk": "2.4.1", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.2.0", - "figures": "2.0.0", - "lodash": "4.17.10", - "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "3.2.1", - "escape-string-regexp": "1.0.5", - "supports-color": "5.4.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "3.0.0" - } - } - } - }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -6320,9 +6338,9 @@ "dev": true }, "require-in-the-middle": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-2.2.1.tgz", - "integrity": "sha512-uYi3hbukpYNEHPYSLKVmBvhvxInqwA1/BzNh6qBYPrHVvFbXFXDBtAkNKpJhHVxymnTREP8y4YJ8E0RpzYxv2g==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-2.2.0.tgz", + "integrity": "sha512-Ztb/p4vpjb/ELXVcoLs/ahXLvKWD2MP4OnIP0OiJbDvgdbHzII6JaUKwiZu53L0viIpBum0TXcGFMO6ovbavkA==", "requires": { "module-details-from-path": "1.0.3", "resolve": "1.7.1" @@ -6394,19 +6412,13 @@ "is-promise": "2.1.0" } }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "rxjs": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", + "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", "dev": true, "requires": { - "rx-lite": "4.0.8" + "tslib": "1.9.0" } }, "safe-buffer": { @@ -6414,6 +6426,12 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -7023,9 +7041,9 @@ "dev": true }, "typescript": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", - "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index f31dde483..330803fae 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@types/glob": "^5.0.32", "@types/is": "0.0.20", "@types/methods": "^1.1.0", - "@types/mocha": "^5.0.0", + "@types/mocha": "5.2.1", "@types/ncp": "^2.0.1", "@types/nock": "^9.1.2", "@types/node": "^10.0.9", @@ -72,7 +72,7 @@ "codecov": "^3.0.0", "express": "^4.15.2", "glob": "^7.0.3", - "gts": "^0.5.1", + "gts": "^0.7.1", "js-green-licenses": "^0.5.0", "jshint": "^2.9.1", "mocha": "^5.0.0", @@ -89,10 +89,10 @@ "timekeeper": "^2.0.0", "tmp": "0.0.33", "ts-node": "^6.0.0", - "typescript": "~2.7.2" + "typescript": "~2.9.2" }, "dependencies": { - "@google-cloud/common": "^0.19.1", + "@google-cloud/common": "^0.20.0", "builtin-modules": "^2.0.0", "continuation-local-storage": "^3.2.1", "extend": "^3.0.0", @@ -101,7 +101,7 @@ "lodash.findindex": "^4.4.0", "lodash.isequal": "^4.0.0", "methods": "^1.1.1", - "require-in-the-middle": "^2.2.1", + "require-in-the-middle": "2.2.0", "semver": "^5.4.1", "shimmer": "^1.2.0", "uuid": "^3.0.1" diff --git a/scripts/check-install.ts b/scripts/check-install.ts index 7b111db37..a273a7ef4 100644 --- a/scripts/check-install.ts +++ b/scripts/check-install.ts @@ -1,4 +1,4 @@ -import * as path from 'path'; +import path from 'path'; import { globP, ncpP, spawnP, tmpDirP } from './utils'; /** diff --git a/scripts/compile.ts b/scripts/compile.ts index 6df3b8550..cf91ae9df 100644 --- a/scripts/compile.ts +++ b/scripts/compile.ts @@ -1,7 +1,7 @@ -import * as path from 'path'; +import path from 'path'; import { forkP } from './utils'; -import * as ts from 'typescript'; -import * as semver from 'semver'; +import ts from 'typescript'; +import semver from 'semver'; export interface CompileOptions { strict: boolean; diff --git a/scripts/get-plugin-types.ts b/scripts/get-plugin-types.ts index 7628dae76..765520114 100644 --- a/scripts/get-plugin-types.ts +++ b/scripts/get-plugin-types.ts @@ -20,7 +20,7 @@ export async function getPluginTypes() { const indexTs = (await readFileP(`${TYPES_DIRECTORY}/index.d.ts`, 'utf8') as string) .split('\n'); for (const line of indexTs) { - const matches = line.match(/^import \* as .* from '\.\/(.+)';\s*\/\/\s*(.+)@(.+)$/); + const matches = line.match(/^import .* from '\.\/(.+)';\s*\/\/\s*(.+)@(.+)$/); if (!matches) { continue; } @@ -34,7 +34,7 @@ export async function getPluginTypes() { cwd: installDir }); await writeFileP(`${installDir}/index.ts`, - `import * as _ from '${name}'; export = _;\n`, 'utf8'); + `import _ from '${name}'; export = _;\n`, 'utf8'); } } } diff --git a/scripts/init-test-fixtures.ts b/scripts/init-test-fixtures.ts index 2f274d56b..0bd33038c 100644 --- a/scripts/init-test-fixtures.ts +++ b/scripts/init-test-fixtures.ts @@ -1,8 +1,8 @@ -import * as path from 'path'; +import path from 'path'; import { BUILD_DIRECTORY, globP, statP, ncpP, spawnP, readFileP, writeFileP, mkdirP } from './utils'; import { readdir } from 'fs'; -import * as pify from 'pify'; -import * as semver from 'semver'; +import pify from 'pify'; +import semver from 'semver'; const readdirP: (path: string) => Promise = pify(readdir); diff --git a/scripts/report-coverage.ts b/scripts/report-coverage.ts index befc890bf..6e7ea6768 100644 --- a/scripts/report-coverage.ts +++ b/scripts/report-coverage.ts @@ -1,6 +1,6 @@ import { BUILD_DIRECTORY, nodule, readFileP, forkP, spawnP } from './utils'; -import * as path from 'path'; -import * as pify from 'pify'; +import path from 'path'; +import pify from 'pify'; export async function reportCoverage() { await forkP(nodule('.bin/codecov'), [], { diff --git a/scripts/run-tests.ts b/scripts/run-tests.ts index 98cb936f6..01579b133 100644 --- a/scripts/run-tests.ts +++ b/scripts/run-tests.ts @@ -1,4 +1,4 @@ -import * as path from 'path'; +import path from 'path'; import { globP, forkP } from './utils'; export interface Options { diff --git a/scripts/utils.ts b/scripts/utils.ts index 39432c41a..cea2daf58 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -1,11 +1,11 @@ import { mkdir, Stats, stat, readFile, writeFile } from 'fs'; -import * as glob from 'glob'; +import glob from 'glob'; import { ncp } from 'ncp'; -import * as path from 'path'; -import * as pify from 'pify'; +import path from 'path'; +import pify from 'pify'; import { ChildProcess, ForkOptions, fork, SpawnOptions, spawn } from 'child_process'; -import * as once from 'once'; -import * as tmp from 'tmp'; +import once from 'once'; +import tmp from 'tmp'; export const BUILD_DIRECTORY = 'build'; diff --git a/src/cls.ts b/src/cls.ts index 91ea7fbfd..b8b57858b 100644 --- a/src/cls.ts +++ b/src/cls.ts @@ -16,7 +16,7 @@ import {Logger} from '@google-cloud/common'; import {EventEmitter} from 'events'; -import * as semver from 'semver'; +import semver from 'semver'; import {AsyncHooksCLS} from './cls/async-hooks'; import {AsyncListenerCLS} from './cls/async-listener'; @@ -83,7 +83,9 @@ export enum TraceCLSMechanism { /** * Configuration options passed to the TraceCLS constructor. */ -export interface TraceCLSConfig { mechanism: TraceCLSMechanism; } +export interface TraceCLSConfig { + mechanism: TraceCLSMechanism; +} interface CLSConstructor { new(defaultContext: RootContext): CLS; diff --git a/src/cls/async-hooks.ts b/src/cls/async-hooks.ts index 05de2c5e6..7befacf69 100644 --- a/src/cls/async-hooks.ts +++ b/src/cls/async-hooks.ts @@ -16,9 +16,9 @@ // This file calls require('async_hooks') in the AsyncHooksCLS constructor, // rather than upon module load. -import * as asyncHooksModule from 'async_hooks'; +import asyncHooksModule from 'async_hooks'; import {EventEmitter} from 'events'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {CLS, Func} from './base'; diff --git a/src/cls/async-listener.ts b/src/cls/async-listener.ts index 81895f3e0..f665c71c1 100644 --- a/src/cls/async-listener.ts +++ b/src/cls/async-listener.ts @@ -16,7 +16,7 @@ // This module requires continuation-local-storage in the AsyncListenerCLS // constructor, rather than upon module load. -import * as clsModule from 'continuation-local-storage'; +import clsModule from 'continuation-local-storage'; import {EventEmitter} from 'events'; import {CLS, Func} from './base'; diff --git a/src/config.ts b/src/config.ts index 20cdbc4e6..a96ea1f4c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as path from 'path'; +import path from 'path'; const pluginDirectory = path.join(path.resolve(__dirname, '..'), 'src', 'plugins'); diff --git a/src/index.ts b/src/index.ts index 5cc78daa9..e096c419f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,10 +18,10 @@ const filesLoadedBeforeTrace = Object.keys(require.cache); // This file's top-level imports must not transitively depend on modules that // do I/O, or continuation-local-storage will not work. -import * as semver from 'semver'; +import semver from 'semver'; import {Config, defaultConfig} from './config'; -import * as extend from 'extend'; -import * as path from 'path'; +import extend from 'extend'; +import path from 'path'; import * as PluginTypes from './plugin-types'; import {tracing, Tracing, NormalizedConfig} from './tracing'; import {Singleton, FORCE_NEW, Forceable} from './util'; diff --git a/src/plugin-types.ts b/src/plugin-types.ts index 153db87b3..0f2b72868 100644 --- a/src/plugin-types.ts +++ b/src/plugin-types.ts @@ -22,7 +22,9 @@ import {TraceLabels} from './trace-labels'; export type Func = (...args: any[]) => T; // Defines an interface for storing Trace-Agent related data on patched modules. -export interface TraceAgentExtension { _google_trace_patched: boolean; } +export interface TraceAgentExtension { + _google_trace_patched: boolean; +} /** * Represents a trace span. diff --git a/src/plugins/plugin-connect.ts b/src/plugins/plugin-connect.ts index 6debd1646..bec3462fd 100644 --- a/src/plugins/plugin-connect.ts +++ b/src/plugins/plugin-connect.ts @@ -15,7 +15,7 @@ */ import {IncomingMessage, ServerResponse} from 'http'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {parse as urlParse} from 'url'; import {PluginTypes} from '..'; diff --git a/src/plugins/plugin-express.ts b/src/plugins/plugin-express.ts index c48cb88fa..d33b508bb 100644 --- a/src/plugins/plugin-express.ts +++ b/src/plugins/plugin-express.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as httpMethods from 'methods'; -import * as shimmer from 'shimmer'; +import httpMethods from 'methods'; +import shimmer from 'shimmer'; import {PluginTypes} from '..'; diff --git a/src/plugins/plugin-hapi.ts b/src/plugins/plugin-hapi.ts index 781312690..57bedd8db 100644 --- a/src/plugins/plugin-hapi.ts +++ b/src/plugins/plugin-hapi.ts @@ -15,7 +15,7 @@ */ import {IncomingMessage, ServerResponse} from 'http'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {parse as urlParse} from 'url'; import {PluginTypes} from '..'; diff --git a/src/plugins/plugin-http.ts b/src/plugins/plugin-http.ts index f94711e30..ca152eca3 100644 --- a/src/plugins/plugin-http.ts +++ b/src/plugins/plugin-http.ts @@ -14,13 +14,13 @@ * limitations under the License. */ -import * as httpModule from 'http'; +import httpModule from 'http'; import {Agent, ClientRequest, ClientRequestArgs, get, request} from 'http'; -import * as httpsModule from 'https'; -import * as is from 'is'; -import * as semver from 'semver'; -import * as shimmer from 'shimmer'; -import * as url from 'url'; +import httpsModule from 'https'; +import is from 'is'; +import semver from 'semver'; +import shimmer from 'shimmer'; +import url from 'url'; import {Plugin, TraceAgent} from '../plugin-types'; diff --git a/src/plugins/plugin-http2.ts b/src/plugins/plugin-http2.ts index aeb28830c..4a1d545b8 100644 --- a/src/plugins/plugin-http2.ts +++ b/src/plugins/plugin-http2.ts @@ -17,8 +17,8 @@ import {EventEmitter} from 'events'; // This is imported only for types. Generated .js file should NOT load 'http2'. // `http2` must be used only in type annotations, not in expressions. -import * as http2 from 'http2'; -import * as shimmer from 'shimmer'; +import http2 from 'http2'; +import shimmer from 'shimmer'; import {URL} from 'url'; import {TraceAgent} from '../plugin-types'; diff --git a/src/plugins/plugin-koa.ts b/src/plugins/plugin-koa.ts index f58b35c9b..69199bd1e 100644 --- a/src/plugins/plugin-koa.ts +++ b/src/plugins/plugin-koa.ts @@ -15,7 +15,7 @@ */ import {IncomingMessage, ServerResponse} from 'http'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {parse as urlParse} from 'url'; import {PluginTypes} from '..'; diff --git a/src/plugins/plugin-pg.ts b/src/plugins/plugin-pg.ts index a0d7d49a9..760525020 100644 --- a/src/plugins/plugin-pg.ts +++ b/src/plugins/plugin-pg.ts @@ -15,7 +15,7 @@ */ import {EventEmitter} from 'events'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {Readable} from 'stream'; import {Patch, Plugin, Span} from '../plugin-types'; diff --git a/src/plugins/plugin-restify.ts b/src/plugins/plugin-restify.ts index 4041f9556..526c55a4d 100644 --- a/src/plugins/plugin-restify.ts +++ b/src/plugins/plugin-restify.ts @@ -15,7 +15,7 @@ */ import {ServerResponse} from 'http'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {parse as urlParse} from 'url'; import {PluginTypes} from '..'; diff --git a/src/plugins/types/index.d.ts b/src/plugins/types/index.d.ts index 36d4e3add..d11419391 100644 --- a/src/plugins/types/index.d.ts +++ b/src/plugins/types/index.d.ts @@ -27,13 +27,13 @@ * contain dots. */ -import * as connect_3 from './connect_3'; // connect@3 -import * as express_4 from './express_4'; // express@4 -import * as hapi_16 from './hapi_16'; // hapi@16 -import * as hapi_17 from './hapi_17'; // hapi@17 -import * as koa_2 from './koa_2'; // koa@2 -import * as pg_7 from './pg_7'; // pg@7 -import * as restify_5 from './restify_5'; // restify@5 +import connect_3 from './connect_3'; // connect@3 +import express_4 from './express_4'; // express@4 +import hapi_16 from './hapi_16'; // hapi@16 +import hapi_17 from './hapi_17'; // hapi@17 +import koa_2 from './koa_2'; // koa@2 +import pg_7 from './pg_7'; // pg@7 +import restify_5 from './restify_5'; // restify@5 //---other imports---// diff --git a/src/span-data.ts b/src/span-data.ts index 4c10ae6b1..2bd8a2a38 100644 --- a/src/span-data.ts +++ b/src/span-data.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as crypto from 'crypto'; -import * as util from 'util'; +import crypto from 'crypto'; +import util from 'util'; import {Constants, SpanType} from './constants'; import * as types from './plugin-types'; diff --git a/src/trace-api.ts b/src/trace-api.ts index 7e78ec526..2184eb820 100644 --- a/src/trace-api.ts +++ b/src/trace-api.ts @@ -15,9 +15,9 @@ */ import {Logger} from '@google-cloud/common'; -import * as is from 'is'; -import * as semver from 'semver'; -import * as uuid from 'uuid'; +import is from 'is'; +import semver from 'semver'; +import uuid from 'uuid'; import {cls, RootContext} from './cls'; import {Constants, SpanType} from './constants'; diff --git a/src/trace-plugin-loader.ts b/src/trace-plugin-loader.ts index 642fff84d..afe230cdb 100644 --- a/src/trace-plugin-loader.ts +++ b/src/trace-plugin-loader.ts @@ -15,15 +15,13 @@ */ import {Logger} from '@google-cloud/common'; -import Module = require('module'); -import * as hook from 'require-in-the-middle'; -import * as path from 'path'; -import * as semver from 'semver'; -import * as shimmer from 'shimmer'; -import * as util from './util'; -import * as builtinModules from 'builtin-modules'; +import builtinModules from 'builtin-modules'; +import path from 'path'; +import hook from 'require-in-the-middle'; +import semver from 'semver'; + +import {Intercept, Patch, Plugin} from './plugin-types'; import {TraceAgent, TraceAgentConfig} from './trace-api'; -import {Patch, Intercept, Plugin, Instrumentation} from './plugin-types'; import {Singleton} from './util'; /** diff --git a/src/trace-writer.ts b/src/trace-writer.ts index 8d331204e..1aca58f4e 100644 --- a/src/trace-writer.ts +++ b/src/trace-writer.ts @@ -18,8 +18,7 @@ import * as common from '@google-cloud/common'; import {AxiosError} from 'axios'; import * as gcpMetadata from 'gcp-metadata'; import {OutgoingHttpHeaders} from 'http'; -import * as os from 'os'; -import * as util from 'util'; +import os from 'os'; import {Constants} from './constants'; import {SpanKind, Trace} from './trace'; @@ -46,7 +45,9 @@ export interface TraceWriterConfig extends common.GoogleAuthOptions { serviceContext: {service?: string; version?: string; minorVersion?: string;}; } -export interface LabelObject { [key: string]: string; } +export interface LabelObject { + [key: string]: string; +} /** * A class representing a service that publishes traces in the background. diff --git a/src/tracing.ts b/src/tracing.ts index dfe7a54d3..859d4d4f5 100644 --- a/src/tracing.ts +++ b/src/tracing.ts @@ -15,8 +15,8 @@ */ import {Logger, logger} from '@google-cloud/common'; -import * as path from 'path'; -import * as semver from 'semver'; +import path from 'path'; +import semver from 'semver'; import {cls, TraceCLSConfig, TraceCLSMechanism} from './cls'; import {CLSMechanism, Config, defaultConfig} from './config'; diff --git a/src/util.ts b/src/util.ts index 9f6988531..0ad08d4f4 100644 --- a/src/util.ts +++ b/src/util.ts @@ -15,7 +15,7 @@ */ import {Logger} from '@google-cloud/common'; // for types only. -import * as path from 'path'; +import path from 'path'; // This symbol must be exported (for now). // See: https://github.com/Microsoft/TypeScript/issues/20080 diff --git a/test/nocks.ts b/test/nocks.ts index 595e645c8..96344667e 100644 --- a/test/nocks.ts +++ b/test/nocks.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as nock from 'nock'; +import nock from 'nock'; const accept = () => true; diff --git a/test/override-gcp-metadata.ts b/test/override-gcp-metadata.ts index a5e0b39ce..4df172b66 100644 --- a/test/override-gcp-metadata.ts +++ b/test/override-gcp-metadata.ts @@ -16,8 +16,8 @@ // Monkeypatch gcp-metadata to not ask for retries at all. -import * as rax from 'retry-axios'; -import * as shimmer from 'shimmer'; +import rax from 'retry-axios'; +import shimmer from 'shimmer'; import { AxiosRequestConfig } from 'axios'; shimmer.wrap(rax, 'attach', attach => { diff --git a/test/plugins/common.ts b/test/plugins/common.ts index e934a0411..a39df3076 100644 --- a/test/plugins/common.ts +++ b/test/plugins/common.ts @@ -15,7 +15,7 @@ */ 'use strict'; -import * as mocha from 'mocha'; +import mocha from 'mocha'; declare global { namespace NodeJS { export interface Global { diff --git a/test/plugins/test-trace-google-gax.ts b/test/plugins/test-trace-google-gax.ts index 98e4a68d4..202079b53 100644 --- a/test/plugins/test-trace-google-gax.ts +++ b/test/plugins/test-trace-google-gax.ts @@ -35,7 +35,7 @@ * in which createApiCall was called. */ -import * as assert from 'assert'; +import assert from 'assert'; import * as testTraceModule from '../trace'; diff --git a/test/plugins/test-trace-grpc.ts b/test/plugins/test-trace-grpc.ts index 3445d36bc..30e431e19 100644 --- a/test/plugins/test-trace-grpc.ts +++ b/test/plugins/test-trace-grpc.ts @@ -20,11 +20,11 @@ import { Constants, SpanType } from '../../src/constants'; import { TraceLabels } from '../../src/trace-labels'; import * as TracingPolicy from '../../src/tracing-policy'; import * as util from '../../src/util'; -import * as assert from 'assert'; +import assert from 'assert'; import { asRootSpanData } from '../utils'; import { Span } from '../../src/plugin-types'; import { FORCE_NEW } from '../../src/util'; -import * as semver from 'semver'; +import semver from 'semver'; var shimmer = require('shimmer'); var common = require('./common'/*.js*/); @@ -334,7 +334,7 @@ Object.keys(versions).forEach(function(version) { endTransaction(); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.strictEqual(trace.labels.argument, '{"n":42}'); assert.strictEqual(trace.labels.result, '{"n":42}'); @@ -342,7 +342,7 @@ Object.keys(versions).forEach(function(version) { assertTraceProperties(grpcClientPredicate); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -365,14 +365,14 @@ Object.keys(versions).forEach(function(version) { endTransaction(); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.strictEqual(trace.labels.result, '{"n":45}'); }; assertTraceProperties(grpcClientPredicate); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -385,7 +385,7 @@ Object.keys(versions).forEach(function(version) { endTransaction(); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.strictEqual(trace.labels.argument, '{"n":42}'); return trace; @@ -395,7 +395,7 @@ Object.keys(versions).forEach(function(version) { '{"code":0,"details":"OK","metadata":{"_internal_repr":{}}}'); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -408,7 +408,7 @@ Object.keys(versions).forEach(function(version) { endTransaction(); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); return trace; }; @@ -417,7 +417,7 @@ Object.keys(versions).forEach(function(version) { '{"code":0,"details":"OK","metadata":{"_internal_repr":{}}}'); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -511,9 +511,9 @@ Object.keys(versions).forEach(function(version) { if (++num === 2) { endTransaction(); var traces = common.getMatchingSpans(grpcServerOuterPredicate); - assert(traces.length === 2); - assert(traces[0].spanId !== traces[1].spanId); - assert(traces[0].startTime !== traces[1].startTime); + assert.ok(traces.length === 2); + assert.ok(traces[0].spanId !== traces[1].spanId); + assert.ok(traces[0].startTime !== traces[1].startTime); common.assertSpanDurationCorrect(traces[0], endFirst - startFirst); common.assertSpanDurationCorrect(traces[1], Date.now() - startSecond); setImmediate(prevNext); @@ -569,7 +569,7 @@ Object.keys(versions).forEach(function(version) { common.runInTransaction(function(endTransaction) { client.testUnary({n: EMIT_ERROR}, function(err, result) { endTransaction(); - assert(err); + assert.ok(err); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); assert.ok(trace); @@ -579,7 +579,7 @@ Object.keys(versions).forEach(function(version) { assertTraceProperties(grpcClientPredicate); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -589,7 +589,7 @@ Object.keys(versions).forEach(function(version) { common.runInTransaction(function(endTransaction) { var stream = client.testClientStream(function(err, result) { endTransaction(); - assert(err); + assert.ok(err); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); assert.ok(trace); @@ -598,7 +598,7 @@ Object.keys(versions).forEach(function(version) { assertTraceProperties(grpcClientPredicate); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); stream.write({n: EMIT_ERROR}); @@ -620,7 +620,7 @@ Object.keys(versions).forEach(function(version) { assertTraceProperties(grpcClientPredicate); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -642,7 +642,7 @@ Object.keys(versions).forEach(function(version) { assertTraceProperties(grpcClientPredicate); assertTraceProperties(grpcServerOuterPredicate); // Check that a child span was created in gRPC root span - assert(common.getMatchingSpan(grpcServerInnerPredicate)); + assert.ok(common.getMatchingSpan(grpcServerInnerPredicate)); done(); }); }); @@ -658,7 +658,7 @@ Object.keys(versions).forEach(function(version) { assert.strictEqual(status.code, grpc.status.OK); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.ok(metadataRegExp.test(trace.labels.metadata)); }; @@ -681,7 +681,7 @@ Object.keys(versions).forEach(function(version) { assert.strictEqual(status.code, grpc.status.OK); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.ok(metadataRegExp.test(trace.labels.metadata)); }; @@ -701,7 +701,7 @@ Object.keys(versions).forEach(function(version) { assert.ifError(err); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.ok(metadataRegExp.test(trace.labels.metadata)); return trace; @@ -723,7 +723,7 @@ Object.keys(versions).forEach(function(version) { assert.ifError(err); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.ok(metadataRegExp.test(trace.labels.metadata)); return trace; @@ -748,7 +748,7 @@ Object.keys(versions).forEach(function(version) { assert.ifError(err); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.ok(metadataRegExp.test(trace.labels.metadata)); return trace; @@ -771,7 +771,7 @@ Object.keys(versions).forEach(function(version) { assert.ifError(err); var assertTraceProperties = function(predicate) { var trace = common.getMatchingSpan(predicate); - assert(trace); + assert.ok(trace); common.assertDurationCorrect(Date.now() - start, predicate); assert.ok(metadataRegExp.test(trace.labels.metadata)); return trace; diff --git a/test/plugins/test-trace-http.ts b/test/plugins/test-trace-http.ts index b88e7acb7..10e747f5e 100644 --- a/test/plugins/test-trace-http.ts +++ b/test/plugins/test-trace-http.ts @@ -14,15 +14,15 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import {EventEmitter} from 'events'; -import * as fs from 'fs'; -import * as httpModule from 'http'; -import * as httpsModule from 'https'; +import fs from 'fs'; +import httpModule from 'http'; +import httpsModule from 'https'; import {AddressInfo} from 'net'; -import * as path from 'path'; -import * as semver from 'semver'; -import * as stream from 'stream'; +import path from 'path'; +import semver from 'semver'; +import stream from 'stream'; import {URL} from 'url'; import {Constants} from '../../src/constants'; diff --git a/test/plugins/test-trace-http2.ts b/test/plugins/test-trace-http2.ts index 0bc27342f..4db487d72 100644 --- a/test/plugins/test-trace-http2.ts +++ b/test/plugins/test-trace-http2.ts @@ -21,12 +21,12 @@ require('../../..').start({ samplingRate: 0, }); -import * as assert from 'assert'; +import assert from 'assert'; // This is imported only for types. Generated .js file should NOT load 'http2' // in this place. It is dynamically loaded later from each test suite below. -import * as http2 from 'http2'; -import * as semver from 'semver'; -import * as stream from 'stream'; +import http2 from 'http2'; +import semver from 'semver'; +import stream from 'stream'; import {Constants} from '../../src/constants'; import {TraceLabels} from '../../src/trace-labels'; diff --git a/test/test-agent-stopped.ts b/test/test-agent-stopped.ts index b9b8171ad..917eb9e3d 100644 --- a/test/test-agent-stopped.ts +++ b/test/test-agent-stopped.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import * as assert from 'assert'; -import * as http from 'http'; +import assert from 'assert'; +import http from 'http'; import * as traceTestModule from './trace'; import { pluginLoader, PluginLoaderState } from '../src/trace-plugin-loader'; import { TraceWriter } from '../src/trace-writer'; diff --git a/test/test-cls-ah.ts b/test/test-cls-ah.ts index a945344d5..62a41426c 100644 --- a/test/test-cls-ah.ts +++ b/test/test-cls-ah.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import * as assert from 'assert'; -import * as asyncHooksModule from 'async_hooks'; +import assert from 'assert'; +import asyncHooksModule from 'async_hooks'; import {IContextDefinition} from 'mocha'; -import * as semver from 'semver'; +import semver from 'semver'; import {AsyncHooksCLS} from '../src/cls/async-hooks'; diff --git a/test/test-cls.ts b/test/test-cls.ts index d5fa2e5f3..65dbd9840 100644 --- a/test/test-cls.ts +++ b/test/test-cls.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import {EventEmitter} from 'events'; import {ITestDefinition} from 'mocha'; -import * as semver from 'semver'; +import semver from 'semver'; import {inspect} from 'util'; import {TraceCLS, TraceCLSConfig, TraceCLSMechanism} from '../src/cls'; diff --git a/test/test-config-cls.ts b/test/test-config-cls.ts index bb0e03aba..90d2d1695 100644 --- a/test/test-config-cls.ts +++ b/test/test-config-cls.ts @@ -15,9 +15,9 @@ */ import {Logger} from '@google-cloud/common'; -import * as assert from 'assert'; -import * as semver from 'semver'; -import * as util from 'util'; +import assert from 'assert'; +import semver from 'semver'; +import util from 'util'; import {TraceCLSConfig, TraceCLSMechanism} from '../src/cls'; diff --git a/test/test-config-credentials.ts b/test/test-config-credentials.ts index 3d1edf932..5451a02cf 100644 --- a/test/test-config-credentials.ts +++ b/test/test-config-credentials.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import * as assert from 'assert'; -import * as nock from 'nock'; +import assert from 'assert'; +import nock from 'nock'; import {disableNetConnect, enableNetConnect} from 'nock'; -import * as path from 'path'; +import path from 'path'; import {FORCE_NEW} from '../src/util'; import {oauth2, patchTraces} from './nocks'; diff --git a/test/test-config-plugins.ts b/test/test-config-plugins.ts index d6b76d98b..c9537038b 100644 --- a/test/test-config-plugins.ts +++ b/test/test-config-plugins.ts @@ -15,7 +15,7 @@ */ import {Logger} from '@google-cloud/common'; -import * as assert from 'assert'; +import assert from 'assert'; import {defaultConfig} from '../src/config'; import {PluginLoader, PluginLoaderConfig} from '../src/trace-plugin-loader'; diff --git a/test/test-default-ignore-ah-health.ts b/test/test-default-ignore-ah-health.ts index 4c88bfc03..d8b470a01 100644 --- a/test/test-default-ignore-ah-health.ts +++ b/test/test-default-ignore-ah-health.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import * as trace from './trace'; diff --git a/test/test-env-log-level.ts b/test/test-env-log-level.ts index f596674cb..90e0d4910 100644 --- a/test/test-env-log-level.ts +++ b/test/test-env-log-level.ts @@ -15,10 +15,8 @@ */ import * as common from '@google-cloud/common'; -import * as assert from 'assert'; -import * as shimmer from 'shimmer'; - -import {FORCE_NEW} from '../src/util'; +import assert from 'assert'; +import shimmer from 'shimmer'; import {TestLogger} from './logger'; import * as traceTestModule from './trace'; diff --git a/test/test-grpc-context.ts b/test/test-grpc-context.ts index e04d4c1f1..92f8e0003 100644 --- a/test/test-grpc-context.ts +++ b/test/test-grpc-context.ts @@ -15,7 +15,7 @@ */ 'use strict'; -import * as semver from 'semver'; +import semver from 'semver'; // Trace agent must be started out of the loop over gRPC versions, // because express can't be re-patched. diff --git a/test/test-modules-loaded-before-agent.ts b/test/test-modules-loaded-before-agent.ts index 5ade8767d..f7a746bee 100644 --- a/test/test-modules-loaded-before-agent.ts +++ b/test/test-modules-loaded-before-agent.ts @@ -15,8 +15,8 @@ */ import * as common from '@google-cloud/common'; -import * as assert from 'assert'; -import * as shimmer from 'shimmer'; +import assert from 'assert'; +import shimmer from 'shimmer'; import {TestLogger} from './logger'; import * as testTraceModule from './trace'; diff --git a/test/test-plugin-loader.ts b/test/test-plugin-loader.ts index e1fdd706c..c8199546f 100644 --- a/test/test-plugin-loader.ts +++ b/test/test-plugin-loader.ts @@ -14,11 +14,8 @@ * limitations under the License. */ -import {Logger} from '@google-cloud/common'; -import * as assert from 'assert'; -import * as path from 'path'; -import * as hook from 'require-in-the-middle'; -import * as shimmer from 'shimmer'; +import assert from 'assert'; +import path from 'path'; import {PluginLoader, PluginLoaderState, PluginWrapper} from '../src/trace-plugin-loader'; diff --git a/test/test-preloaded-agent.ts b/test/test-preloaded-agent.ts index 01e03c2c8..1854f4d1e 100644 --- a/test/test-preloaded-agent.ts +++ b/test/test-preloaded-agent.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import * as semver from 'semver'; +import semver from 'semver'; import { execSync } from 'child_process'; -import * as assert from 'assert'; +import assert from 'assert'; describe('preloaded agent', () => { it('should start automatically when preloaded using --require', () => { diff --git a/test/test-span-data.ts b/test/test-span-data.ts index 805fbc71b..aef3b6b00 100644 --- a/test/test-span-data.ts +++ b/test/test-span-data.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import {Constants, SpanType} from '../src/constants'; import {BaseSpanData, ChildSpanData, RootSpanData} from '../src/span-data'; diff --git a/test/test-trace-api-none-cls.ts b/test/test-trace-api-none-cls.ts index b04154b35..afa1cf851 100644 --- a/test/test-trace-api-none-cls.ts +++ b/test/test-trace-api-none-cls.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import {SpanType} from '../src/constants'; import {TraceAgent} from '../src/plugin-types'; diff --git a/test/test-trace-api.ts b/test/test-trace-api.ts index cfbf8c618..3ec34d9d7 100644 --- a/test/test-trace-api.ts +++ b/test/test-trace-api.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import {cls, TraceCLS, TraceCLSMechanism} from '../src/cls'; import {defaultConfig} from '../src/config'; diff --git a/test/test-trace-cluster.ts b/test/test-trace-cluster.ts index 84a11ea6b..73e11b56d 100644 --- a/test/test-trace-cluster.ts +++ b/test/test-trace-cluster.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import axiosModule from 'axios'; -import * as cluster from 'cluster'; +import cluster from 'cluster'; import {Server} from 'http'; import {AddressInfo} from 'net'; diff --git a/test/test-trace-uncaught-exception.ts b/test/test-trace-uncaught-exception.ts index 1a595ae59..0160d14bc 100644 --- a/test/test-trace-uncaught-exception.ts +++ b/test/test-trace-uncaught-exception.ts @@ -15,7 +15,7 @@ */ import {Logger} from '@google-cloud/common'; -import * as assert from 'assert'; +import assert from 'assert'; import {TraceWriterConfig} from '../src/trace-writer'; diff --git a/test/test-trace-web-frameworks.ts b/test/test-trace-web-frameworks.ts index 657c4ac03..05650f9bb 100644 --- a/test/test-trace-web-frameworks.ts +++ b/test/test-trace-web-frameworks.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import * as assert from 'assert'; +import assert from 'assert'; import axiosModule from 'axios'; -import * as semver from 'semver'; +import semver from 'semver'; import * as cls from '../src/cls'; import {Constants} from '../src/constants'; diff --git a/test/test-trace-writer.ts b/test/test-trace-writer.ts index dfb5852cf..efe1e44b3 100644 --- a/test/test-trace-writer.ts +++ b/test/test-trace-writer.ts @@ -15,12 +15,12 @@ */ import {Service} from '@google-cloud/common'; -import * as assert from 'assert'; +import assert from 'assert'; import {OutgoingHttpHeaders} from 'http'; -import * as nock from 'nock'; -import * as os from 'os'; +import nock from 'nock'; +import os from 'os'; import {Response} from 'request'; -import * as shimmer from 'shimmer'; +import shimmer from 'shimmer'; import {SpanKind, Trace} from '../src/trace'; import {TraceLabels} from '../src/trace-labels'; diff --git a/test/test-util.ts b/test/test-util.ts index 30cc30ef8..4c45366c9 100644 --- a/test/test-util.ts +++ b/test/test-util.ts @@ -15,7 +15,7 @@ */ import {Logger} from '@google-cloud/common'; -import * as assert from 'assert'; +import assert from 'assert'; import {inspect} from 'util'; import {Constants} from '../src/constants'; diff --git a/test/trace.ts b/test/trace.ts index 8501d5dc2..889819fef 100644 --- a/test/trace.ts +++ b/test/trace.ts @@ -35,8 +35,8 @@ */ import * as common from '@google-cloud/common'; -import * as assert from 'assert'; -import * as shimmer from 'shimmer'; +import assert from 'assert'; +import shimmer from 'shimmer'; import * as trace from '../src'; import {Config, PluginTypes} from '../src'; diff --git a/test/utils.ts b/test/utils.ts index c8cc1822c..57794deb0 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -16,7 +16,7 @@ // TODO(kjin): This file should supercede plugins/common.ts. -import * as assert from 'assert'; +import assert from 'assert'; import {SpanType} from '../src/constants'; import {Span} from '../src/plugin-types'; diff --git a/test/web-frameworks/connect.ts b/test/web-frameworks/connect.ts index 40522934c..ecbf1ae70 100644 --- a/test/web-frameworks/connect.ts +++ b/test/web-frameworks/connect.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as http from 'http'; +import http from 'http'; import {AddressInfo} from 'net'; import {connect_3} from '../../src/plugins/types'; diff --git a/test/web-frameworks/express.ts b/test/web-frameworks/express.ts index e339adc76..dda158dd5 100644 --- a/test/web-frameworks/express.ts +++ b/test/web-frameworks/express.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as http from 'http'; +import http from 'http'; import {AddressInfo} from 'net'; import {express_4} from '../../src/plugins/types'; diff --git a/test/web-frameworks/hapi8_16.ts b/test/web-frameworks/hapi8_16.ts index 5a92bf954..4e06aad08 100644 --- a/test/web-frameworks/hapi8_16.ts +++ b/test/web-frameworks/hapi8_16.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as http from 'http'; +import http from 'http'; import {hapi_16} from '../../src/plugins/types'; diff --git a/test/web-frameworks/koa1.ts b/test/web-frameworks/koa1.ts index 776e70f97..53177ad9d 100644 --- a/test/web-frameworks/koa1.ts +++ b/test/web-frameworks/koa1.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as http from 'http'; +import http from 'http'; import {AddressInfo} from 'net'; import {koa_1} from '../../src/plugins/types'; diff --git a/test/web-frameworks/koa2.ts b/test/web-frameworks/koa2.ts index 7c21f90d3..7adfe1e13 100644 --- a/test/web-frameworks/koa2.ts +++ b/test/web-frameworks/koa2.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as http from 'http'; +import http from 'http'; import {AddressInfo} from 'net'; import {koa_2 as Koa} from '../../src/plugins/types'; diff --git a/test/web-frameworks/restify.ts b/test/web-frameworks/restify.ts index f918545a5..4aa8f680b 100644 --- a/test/web-frameworks/restify.ts +++ b/test/web-frameworks/restify.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import * as http from 'http'; +import http from 'http'; import {restify_5} from '../../src/plugins/types';