nuxt-error-tracker 0.1.13 → 0.1.15
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/module.json +1 -1
- package/dist/runtime/plugin.client.js +10 -5
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -115,6 +115,13 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
115
115
|
"unhandledrejection",
|
|
116
116
|
(event) => capture(event.reason, "promise")
|
|
117
117
|
);
|
|
118
|
+
const formatDataAttrs = (el) => {
|
|
119
|
+
const dataset = el.dataset;
|
|
120
|
+
if (!dataset) return "";
|
|
121
|
+
return Object.entries(dataset).slice(0, 5).map(
|
|
122
|
+
([k, v]) => `data-${k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}=${(v ?? "").slice(0, 40)}`
|
|
123
|
+
).join(" ");
|
|
124
|
+
};
|
|
118
125
|
document.addEventListener(
|
|
119
126
|
"click",
|
|
120
127
|
(event) => {
|
|
@@ -123,10 +130,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
123
130
|
const tag = el.tagName.toLowerCase();
|
|
124
131
|
const id = el.id ? `#${el.id}` : "";
|
|
125
132
|
const cls = typeof el.className === "string" && el.className ? `.${el.className.trim().split(/\s+/).slice(0, 2).join(".")}` : "";
|
|
126
|
-
const
|
|
127
|
-
const dataAttrs = dataset ? Object.entries(dataset).slice(0, 5).map(
|
|
128
|
-
([k, v]) => `data-${k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}=${(v ?? "").slice(0, 40)}`
|
|
129
|
-
).join(" ") : "";
|
|
133
|
+
const dataAttrs = formatDataAttrs(el);
|
|
130
134
|
const text = (el.textContent ?? "").trim().slice(0, 40);
|
|
131
135
|
addCrumb({
|
|
132
136
|
type: "click",
|
|
@@ -165,10 +169,11 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
165
169
|
if (!raw) return;
|
|
166
170
|
value = raw.length > 100 ? `${raw.slice(0, 100)}\u2026` : raw;
|
|
167
171
|
}
|
|
172
|
+
const dataAttrs = formatDataAttrs(el);
|
|
168
173
|
addCrumb({
|
|
169
174
|
type: "input",
|
|
170
175
|
category: "ui.input",
|
|
171
|
-
message: `${fieldLabel(el)} = ${value}`
|
|
176
|
+
message: `${fieldLabel(el)}${dataAttrs ? ` [${dataAttrs}]` : ""} = ${value}`
|
|
172
177
|
});
|
|
173
178
|
} catch {
|
|
174
179
|
}
|