From 7c5e25f81b0626ed57266b5d798ca992b92332d8 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 29 May 2024 17:05:21 +0100 Subject: [PATCH] perf(kit,nuxt): remove handling for node 14 perf api (#27396) --- packages/kit/src/module/define.ts | 4 ++-- packages/nuxt/src/core/app.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/kit/src/module/define.ts b/packages/kit/src/module/define.ts index 3327ca4ad5..ff2a56d2d4 100644 --- a/packages/kit/src/module/define.ts +++ b/packages/kit/src/module/define.ts @@ -73,8 +73,8 @@ export function defineNuxtModule (definition: Mo const key = `nuxt:module:${uniqueKey || (Math.round(Math.random() * 10000))}` const mark = performance.mark(key) const res = await module.setup?.call(null as any, _options, nuxt) ?? {} - const perf = performance.measure(key, mark?.name) // TODO: remove when Node 14 reaches EOL - const setupTime = perf ? Math.round((perf.duration * 100)) / 100 : 0 // TODO: remove when Node 14 reaches EOL + const perf = performance.measure(key, mark.name) + const setupTime = Math.round((perf.duration * 100)) / 100 // Measure setup time if (setupTime > 5000 && uniqueKey !== '@nuxt/telemetry') { diff --git a/packages/nuxt/src/core/app.ts b/packages/nuxt/src/core/app.ts index 552015c40a..4bc7da1e91 100644 --- a/packages/nuxt/src/core/app.ts +++ b/packages/nuxt/src/core/app.ts @@ -85,8 +85,8 @@ export async function generateApp (nuxt: Nuxt, app: NuxtApp, options: { filter?: changedTemplates.push(template) } - const perf = performance.measure(fullPath, mark?.name) // TODO: remove when Node 14 reaches EOL - const setupTime = perf ? Math.round((perf.duration * 100)) / 100 : 0 // TODO: remove when Node 14 reaches EOL + const perf = performance.measure(fullPath, mark.name) + const setupTime = Math.round((perf.duration * 100)) / 100 if (nuxt.options.debug || setupTime > 500) { logger.info(`Compiled \`${template.filename}\` in ${setupTime}ms`)