Skip to content

feat(utils): performance TS ext - #1213

Closed
BioPhoton wants to merge 21 commits into
mainfrom
feat/utils/performance-ts-ext
Closed

feat(utils): performance TS ext#1213
BioPhoton wants to merge 21 commits into
mainfrom
feat/utils/performance-ts-ext

Conversation

@BioPhoton

@BioPhotonBioPhoton commented Jan 12, 2026

Copy link
Copy Markdown
Collaborator

Related to #1197

This PR includes:

  • perf-hooks.d.ts types to extend performance APIs with Chrome DevTools Extensibility API types so we get autocomplete and type checks when using e.g. performance.mark('mark-name', { details: /*this is typed*/})

@nx-cloud

nx-cloudBot commented Jan 12, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a08b227

CommandStatusDurationResult
nx run-many --targets=code-pushup --parallel=fa...❌ Failed12m 52sView ↗
nx run-many -t unit-test,int-test✅ Succeeded12sView ↗

☁️ Nx Cloud last updated this comment at 2026-02-01 22:04:52 UTC

@github-actions

github-actionsBot commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 7dbf3e3 with previous commit 7b6e72c.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Documentation🟡 53🔴 40↓ −12.9
Performance🔴 33🔴 36↑ +3
Security🔴 47🔴 45↓ −2.5
Code style🟢 100🟢 98↓ −2.1
Bug prevention🟡 75🟡 75↓ −0.2
Code coverage🟢 93🟢 93↓ −0.1
Axe Accessibility🟡 88🟡 88↓ −0.1
Updates🟡 78🟡 78
Type Safety🟡 67🟡 67
Miscellaneous🟡 67🟡 67
Accessibility🟢 92🟢 92
Best Practices🟢 100🟢 100
SEO🟢 92🟢 92
👍 1 group improved, 👎 6 groups regressed, 👍 6 audits improved, 👎 16 audits regressed, 15 audits changed without impacting score

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
ESLintStylistic (functional)🟢 100🟡 50↓ −50
JSDocs coverageDocumentation coverage🟡 53🔴 40↓ −12.9
LighthousePerformance🔴 33🔴 36↑ +3
JS packagesnpm audit🔴 47🔴 45↓ −2.5
ESLintSuggestions🟢 100🟢 98↓ −2.1
ESLintProblems🟢 100🟢 99↓ −0.7
Code coverageCode coverage metrics🟢 93🟢 93↓ −0.1

27 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
LighthouseInitial server response time was short🟥 Root document took 620 ms🟩 Root document took 480 ms↓ −23 %
ESLintrequire setup and teardown to be within a hook🟩 passed🟥 19 warnings↑ +∞ %
ESLintDisallow unused expressions🟩 passed🟥 9 warnings↑ +∞ %
JSDocs coverageInterfaces coverage🟩 0 undocumented interfaces🟥 9 undocumented interfaces↑ +∞ %
ESLintDisallow unused variables🟩 passed🟥 7 errors↑ +∞ %
ESLintEnforce using a particular method signature syntax🟩 passed🟥 7 warnings↑ +∞ %
ESLintPrefer property signatures over method signatures.🟩 passed🟥 7 warnings↑ +∞ %
ESLintDisallow the any type🟩 passed🟥 4 errors↑ +∞ %
ESLintPrefer using the node: protocol when importing Node.js builtin modules.🟩 passed🟥 1 warning↑ +∞ %
JSDocs coverageMethods coverage🟨 10 undocumented methods🟨 22 undocumented methods↑ +120 %
LighthouseTotal Blocking Time🟥 3,150 ms🟥 1,640 ms↓ −48 %
LighthouseFirst Contentful Paint🟥 3.1 s🟥 3.3 s↑ +7.3 %
LighthouseSpeed Index🟥 7.3 s🟥 6.8 s↓ −7.2 %
JSDocs coverageClasses coverage🟨 5 undocumented classes🟨 6 undocumented classes↑ +20 %
JS packagesVulnerabilities for npm prod dependencies.🟨 11 vulnerabilities (2 high, 2 moderate, 7 low)🟨 11 vulnerabilities (2 high, 3 moderate, 6 low) +0 %
LighthouseTime to Interactive🟥 14.2 s🟥 13.5 s↓ −5.2 %
JSDocs coverageProperties coverage🟥 42 undocumented properties🟥 46 undocumented properties↑ +9.5 %
JSDocs coverageTypes coverage🟥 264 undocumented types🟥 266 undocumented types↑ +0.8 %
Code coverageBranch coverage🟨 89.2 %🟨 89.1 %↓ −0.1 %
JSDocs coverageFunctions coverage🟥 585 undocumented functions🟥 586 undocumented functions↑ +0.2 %
Code coverageLine coverage🟩 92.8 %🟩 92.8 %↓ −0.1 %
Code coverageFunction coverage🟩 94.4 %🟩 94.4 %↑ +0.1 %
LighthouseAvoids enormous network payloads🟩 Total size was 2,087 KiB🟩 Total size was 2,096 KiB↑ +0.4 %
LighthouseMinimizes main-thread work🟥 13.9 s🟥 9.7 s↓ −30.5 %
LighthouseJavaScript execution time🟥 4.6 s🟥 3.3 s↓ −28.6 %
LighthouseMetrics🟩 100%🟩 100%↓ −5.2 %
LighthouseServer Backend Latencies🟩 640 ms🟩 1,120 ms↑ +76.3 %
LighthouseUses efficient cache policy on static assets🟨 31 resources found🟨 31 resources found↑ +0.1 %
LighthouseLargest Contentful Paint🟥 11.7 s🟥 12.0 s↑ +3.1 %
LighthouseReduce unused CSS🟥 Potential savings of 125 KiB🟥 Potential savings of 139 KiB↑ +31.7 %
LighthouseMax Potential First Input Delay🟥 1,190 ms🟥 1,040 ms↓ −13 %
LighthouseNetwork Round Trip Times🟩 10 ms🟩 60 ms↑ +793.9 %
LighthouseReduce unused JavaScript🟥 Potential savings of 225 KiB🟥 Potential savings of 225 KiB↑ +4.1 %
LighthouseRemove duplicate modules in JavaScript bundles🟥 Potential savings of 86 KiB🟥 Potential savings of 86 KiB↑ +4.4 %
TypeScriptSemantic errors🟥 43 errors🟥 52 errors↑ +20.9 %
LighthouseARIA tooltip elements have accessible names🟩 passed🟩 0↓ −100 %
AxeARIA hidden element must not be focusable or contain focusable elements🟩 201 elements🟩 202 elements↑ +0.5 %

642 other audits are unchanged.

@pkg-pr-new

pkg-pr-newBot commented Jan 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1213

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1213

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1213

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1213

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1213

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1213

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1213

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1213

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1213

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1213

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1213

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1213

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1213

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1213

commit: a08b227

@github-actions

github-actionsBot commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🥳 Code PushUp report has improved – compared current commit 42e5f04 with previous commit 91f50cf.

💼 Project utils

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Documentation🔴 42🔴 42↑ +0.1

5 other categories are unchanged.

👍 1 group improved, 👍 1 audit improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
JSDocs coverageDocumentation coverage🔴 42🔴 42↑ +0.1

14 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
JSDocs coverageTypes coverage🟥 65 undocumented types🟥 65 undocumented types +0 %

443 other audits are unchanged.


13 other projects are unchanged.

@BioPhoton
BioPhoton marked this pull request as ready for review February 1, 2026 20:50

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends Node’s perf_hooks typings with Chrome DevTools Extensibility API support and wires that through the profiler utilities so performance.mark/measure and trace encoding/decoding understand structured detail.devtools payloads.

Changes:

  • Adds perf-hooks.d.ts module augmentations and a type-focused test suite to give perf_hooks entries/marks/measures a typed detail.devtools payload and stricter mark/measure option typing.
  • Adjusts user-timing detail/DevTools payload types plus trace encode/decode utilities and tests to round-trip DevTools-style detail structures.
  • Updates TS configs and a report-loading test to include new .d.ts files and reflect required configuration properties.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/utils/tsconfig.test.jsonIncludes top-level src/*.d.ts so type tests pick up local declaration files.
packages/utils/tsconfig.lib.jsonChanges library outDir and include patterns to emit declarations alongside src and include new .d.ts files.
packages/utils/src/perf-hooks.type.test.tsNew type-only tests asserting the augmented perf_hooks APIs and DevTools payload typings; currently reference some undefined helper types.
packages/utils/src/perf-hooks.d.tsNew declaration file augmenting perf_hooks/node:perf_hooks with DevTools-aware entry, mark, measure, observer list, and performance typings.
packages/utils/src/lib/user-timing-extensibility-api.type.tsTightens WithDevToolsPayload/DetailPayloadWithDevtools/UserTimingDetail definitions to require devtools and adds a convenience detail type.
packages/utils/src/lib/reports/load-report.unit.test.tsUpdates loadReport tests to pass skipReports: false in line with the stricter PersistConfig typing.
packages/utils/src/lib/profiler/trace-file-utils.unit.test.tsAdjusts expectations for encode/decode helpers and trace event helpers to work with DevTools-shaped detail.devtools payloads.
packages/utils/src/lib/profiler/trace-file-utils.tsGeneralizes encodeDetail/decodeDetail, adds encodeDetailToString, and updates trace encode/decode helpers to correctly handle JSON-string and object forms of DevTools detail payloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +82
},
}) satisfies PerformanceEntryWithDevtools;
// Invalid examples
({

CopilotAIFeb 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PerformanceEntryWithDevtools is referenced here but is not declared anywhere in the project, which will cause a TypeScript error (Cannot find name 'PerformanceEntryWithDevtools') when running the tests. Please either introduce this type (e.g. as a typed alias for PerformanceEntry with the detail payload) or change the tests to assert against an existing exported type instead.

Copilot uses AI. Check for mistakes.
Comment threadpackages/utils/src/lib/user-timing-extensibility-api.type.ts Outdated
Comment threadpackages/utils/src/perf-hooks.type.test.ts Outdated
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "dist",

CopilotAIFeb 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing compilerOptions.outDir to "dist" deviates from the convention used by other packages (e.g. packages/core/tsconfig.lib.json:4 and packages/cli/tsconfig.lib.json:4 still use "../../dist/out-tsc") and may break tooling or publish scripts that expect all library outputs under dist/out-tsc. Please double-check the build/publish configuration for this package and either keep the outDir consistent with the rest of the repo or update the consumers of the build output accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +52
},
},
}) satisfies PerformanceMeasureOptionsWithDevtools;
// Invalid examples

CopilotAIFeb 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PerformanceMeasureOptionsWithDevtools is used here but is not declared anywhere in the codebase, so this test file will fail to type-check with Cannot find name 'PerformanceMeasureOptionsWithDevtools'. Either import/define this type (for example as an alias to the existing MeasureOptionsWithDevtools<...>), or update the test to use an existing exported type such as PerformanceMeasureOptions.

Copilot uses AI. Check for mistakes.
BioPhotonand others added 2 commits February 1, 2026 22:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
CopilotAI reviewed Feb 2, 2026

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@BioPhoton

Copy link
Copy Markdown
CollaboratorAuthor

Ill drop this feature in favour of our helpers that are fully compatible with all native APIs.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@BioPhoton