cwj_monitoring 0.0.25 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +41 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -15
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +41 -15
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -109,6 +109,13 @@
|
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
const isIgnoredScriptSource = (sourceURL) => {
|
|
113
|
+
if (!sourceURL || typeof sourceURL !== "string")
|
|
114
|
+
return false;
|
|
115
|
+
if (/node_modules/.test(sourceURL))
|
|
116
|
+
return true;
|
|
117
|
+
return false;
|
|
118
|
+
};
|
|
112
119
|
|
|
113
120
|
const MAX_CACHE_LEN = 5;
|
|
114
121
|
const MAX_WAITING_TIME = 3e4;
|
|
@@ -667,21 +674,40 @@
|
|
|
667
674
|
}
|
|
668
675
|
const threshold = options.loafThreshold ?? DEFAULT_LOAF_THRESHOLD;
|
|
669
676
|
if (entry.duration > threshold) {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
677
|
+
const scripts = Array.isArray(entry.scripts) ? entry.scripts : [];
|
|
678
|
+
let isUserTriggered = false;
|
|
679
|
+
let allIgnored = true;
|
|
680
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
681
|
+
const s = scripts[i];
|
|
682
|
+
if (!s)
|
|
683
|
+
continue;
|
|
684
|
+
if (!isUserTriggered && s.invokerType === "user-callback")
|
|
685
|
+
isUserTriggered = true;
|
|
686
|
+
if (allIgnored && !isIgnoredScriptSource(s.sourceURL)) {
|
|
687
|
+
allIgnored = false;
|
|
688
|
+
}
|
|
689
|
+
if (isUserTriggered && !allIgnored)
|
|
690
|
+
break;
|
|
691
|
+
}
|
|
692
|
+
if (isUserTriggered && !allIgnored) {
|
|
693
|
+
context?.emit(EMIT_TYPE.PERFORMANCE_LOAF, {
|
|
694
|
+
duration: entry.duration,
|
|
695
|
+
startTime: entry.startTime,
|
|
696
|
+
renderStart: entry.renderStart,
|
|
697
|
+
styleAndLayoutStart: entry.styleAndLayoutStart,
|
|
698
|
+
hadRecentInput: entry.hadRecentInput,
|
|
699
|
+
scripts: entry.scripts.map((s) => ({
|
|
700
|
+
duration: s.duration,
|
|
701
|
+
invoker: s.invoker,
|
|
702
|
+
invokerType: s.invokerType,
|
|
703
|
+
sourceURL: s.sourceURL,
|
|
704
|
+
functionName: s.functionName,
|
|
705
|
+
sourceFunctionName: s.sourceFunctionName,
|
|
706
|
+
sourceCharPosition: s.sourceCharPosition,
|
|
707
|
+
startTime: s.startTime
|
|
708
|
+
}))
|
|
709
|
+
});
|
|
710
|
+
}
|
|
685
711
|
}
|
|
686
712
|
}
|
|
687
713
|
};
|