From 48a1e5166e96432f1fa28d3dc09d37bc32e9e703 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Tue, 5 Jun 2018 20:38:48 -0700 Subject: [PATCH] Update "chrome-trace-event" package and remove types --- declarations.d.ts | 21 --------------------- lib/debug/ProfilingPlugin.js | 13 +++++++++++-- package.json | 2 +- yarn.lock | 12 +++++++++--- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/declarations.d.ts b/declarations.d.ts index 794a87e1674..7a7eaf67da3 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -7,27 +7,6 @@ declare namespace NodeJS { } } -// There are no typings for chrome-trace-event -declare module "chrome-trace-event" { - interface Event { - name: string; - id?: number; - cat: string[]; - args?: Object; - } - - export class Tracer { - constructor(options: { noStream: boolean }); - pipe(stream: NodeJS.WritableStream): void; - instantEvent(event: Event): void; - counter: number; - trace: { - begin(event: Event): void; - end(event: Event): void; - }; - } -} - // There are no typings for @webassemblyjs/ast declare module "@webassemblyjs/ast" { export function traverse( diff --git a/lib/debug/ProfilingPlugin.js b/lib/debug/ProfilingPlugin.js index 484e51dc1df..118d5007de3 100644 --- a/lib/debug/ProfilingPlugin.js +++ b/lib/debug/ProfilingPlugin.js @@ -71,9 +71,18 @@ class Profiler { } } +/** + * @typedef {Object} Trace + * @description an object that wraps Tracer and Profiler with a counter + * @property {Tracer} trace instance of Tracer + * @property {number} counter Counter + * @property {Profiler} profiler instance of Profiler + * @property {Function} end the end function + */ + /** * @param {string} outputPath The location where to write the log. - * @returns {{trace: ?, counter: number, profiler: Profiler, end: Function}} The trace object + * @returns {Trace} The trace object */ function createTrace(outputPath) { const trace = new Tracer({ @@ -325,7 +334,7 @@ const makeInterceptorFor = (instance, tracer) => hookName => ({ /** * @param {string} hookName Name of the hook to profile. - * @param {Tracer} tracer Instance of tracer. + * @param {Trace} tracer The trace object. * @param {object} options Options for the profiled fn. * @param {string} options.name Plugin name * @param {string} options.type Plugin type (sync | async | promise) diff --git a/package.json b/package.json index 101a501c698..9e0ff4b3aab 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "acorn-dynamic-import": "^3.0.0", "ajv": "^6.1.0", "ajv-keywords": "^3.1.0", - "chrome-trace-event": "^0.1.1", + "chrome-trace-event": "^1.0.0", "enhanced-resolve": "^4.0.0", "eslint-scope": "^3.7.1", "json-parse-better-errors": "^1.0.2", diff --git a/yarn.lock b/yarn.lock index a6580f4704b..a84cbd9aa93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -991,9 +991,11 @@ chownr@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" -chrome-trace-event@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-0.1.3.tgz#d395af2d31c87b90a716c831fe326f69768ec084" +chrome-trace-event@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz#45a91bd2c20c9411f0963b5aaeb9a1b95e09cc48" + dependencies: + tslib "^1.9.0" ci-info@^1.0.0: version "1.1.3" @@ -5949,6 +5951,10 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" +tslib@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"