Skip to content

Commit 3f73828

Browse files
authored
fix(deps): update dependency keep-func-props to v6 (#6441)
1 parent b791221 commit 3f73828

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"indent-string": "^5.0.0",
9292
"is-plain-obj": "^4.0.0",
9393
"js-yaml": "^4.0.0",
94-
"keep-func-props": "^4.0.0",
94+
"keep-func-props": "^6.0.0",
9595
"locate-path": "^7.0.0",
9696
"log-process-errors": "^8.0.0",
9797
"map-obj": "^5.0.0",

packages/build/src/time/main.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,23 @@ export const initTimers = function () {
1010
return []
1111
}
1212

13+
type MeasureDurationOptions = {
14+
metricName?: string
15+
parentTag?: string
16+
category?: string
17+
tags?: string[]
18+
}
19+
1320
// Wrap an async function to measure how long it takes.
1421
// The function must:
1522
// - take a plain object as first argument. This must contain a `timers`.
1623
// - return a plain object. This may or may not contain a modified `timers`.
1724
// The `durationNs` will be returned by the function. A new `timers` with the
1825
// additional duration timer will be returned as well.
19-
const kMeasureDuration = function (func, stageTag, { parentTag = undefined, category = undefined } = {}) {
26+
const kMeasureDuration = function (func, stageTag, options: MeasureDurationOptions = {}) {
2027
return async function measuredFunc({ timers, ...opts }, ...args) {
2128
const timerNs = startTimer()
29+
const { parentTag, category } = options
2230
const { timers: timersA = timers, ...returnObject } = await func({ timers, ...opts }, ...args)
2331
const { tags = {} } = returnObject
2432
const durationNs = endTimer(timerNs)
@@ -41,7 +49,12 @@ export const measureDuration = keepFuncProps(kMeasureDuration)
4149
export const createTimer = function (
4250
stageTag,
4351
durationNs,
44-
{ metricName = DEFAULT_METRIC_NAME, parentTag = TOP_PARENT_TAG, category = undefined, tags = undefined } = {},
52+
{
53+
metricName = DEFAULT_METRIC_NAME,
54+
parentTag = TOP_PARENT_TAG,
55+
category = undefined,
56+
tags = undefined,
57+
}: MeasureDurationOptions = {},
4558
) {
4659
return { metricName, stageTag, parentTag, durationNs, category, tags }
4760
}

0 commit comments

Comments
 (0)