@edraj/sauron-browser 1.5.0 → 1.6.0
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/CHANGELOG.md +25 -0
- package/README.md +13 -3
- package/dist/index.cjs +8 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -597,7 +597,7 @@ declare function parseError(err: unknown): Frame[];
|
|
|
597
597
|
/** Small dependency-free helpers shared across the SDK. */
|
|
598
598
|
/** SDK identity, embedded in every envelope header. */
|
|
599
599
|
declare const SDK_NAME = "sauron.javascript";
|
|
600
|
-
declare const SDK_VERSION = "1.
|
|
600
|
+
declare const SDK_VERSION = "1.6.0";
|
|
601
601
|
/**
|
|
602
602
|
* Largest serialized `extra` a single transaction may carry, in bytes.
|
|
603
603
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -597,7 +597,7 @@ declare function parseError(err: unknown): Frame[];
|
|
|
597
597
|
/** Small dependency-free helpers shared across the SDK. */
|
|
598
598
|
/** SDK identity, embedded in every envelope header. */
|
|
599
599
|
declare const SDK_NAME = "sauron.javascript";
|
|
600
|
-
declare const SDK_VERSION = "1.
|
|
600
|
+
declare const SDK_VERSION = "1.6.0";
|
|
601
601
|
/**
|
|
602
602
|
* Largest serialized `extra` a single transaction may carry, in bytes.
|
|
603
603
|
*
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
|
|
5
5
|
// src/utils.ts
|
|
6
6
|
var SDK_NAME = "sauron.javascript";
|
|
7
|
-
var SDK_VERSION = "1.
|
|
7
|
+
var SDK_VERSION = "1.6.0";
|
|
8
8
|
function getGlobal() {
|
|
9
9
|
return globalThis;
|
|
10
10
|
}
|
|
@@ -839,12 +839,12 @@ function installHistory() {
|
|
|
839
839
|
const loc = g2.location;
|
|
840
840
|
if (!hist) return;
|
|
841
841
|
let lastPath = toPath(loc?.href ?? null, loc?.href);
|
|
842
|
-
const emit = (toHref) => {
|
|
842
|
+
const emit = (toHref, operation) => {
|
|
843
843
|
const to = toPath(toHref, loc?.href);
|
|
844
844
|
const from = lastPath;
|
|
845
845
|
lastPath = to;
|
|
846
846
|
if (from === to) return;
|
|
847
|
-
withInternal(() => addNavigationBreadcrumb(from, to));
|
|
847
|
+
withInternal(() => addNavigationBreadcrumb(from, to, operation));
|
|
848
848
|
if (to && navHandler) {
|
|
849
849
|
try {
|
|
850
850
|
navHandler(to);
|
|
@@ -855,11 +855,12 @@ function installHistory() {
|
|
|
855
855
|
const wrap = (name) => {
|
|
856
856
|
const original = hist[name];
|
|
857
857
|
if (typeof original !== "function" || isWrapped(original)) return;
|
|
858
|
+
const operation = name === "pushState" ? "push" : "replace";
|
|
858
859
|
hist[name] = markWrapped(function sauronHistory(...args) {
|
|
859
860
|
const result = original.apply(this, args);
|
|
860
861
|
if (!isInternal()) {
|
|
861
862
|
const urlArg = args[2];
|
|
862
|
-
emit(urlArg != null ? String(urlArg) : loc?.href ?? null);
|
|
863
|
+
emit(urlArg != null ? String(urlArg) : loc?.href ?? null, operation);
|
|
863
864
|
}
|
|
864
865
|
return result;
|
|
865
866
|
});
|
|
@@ -871,7 +872,7 @@ function installHistory() {
|
|
|
871
872
|
wrap("replaceState");
|
|
872
873
|
if (typeof g2.addEventListener === "function") {
|
|
873
874
|
const onPopState = () => {
|
|
874
|
-
if (!isInternal()) emit(loc?.href ?? null);
|
|
875
|
+
if (!isInternal()) emit(loc?.href ?? null, "pop");
|
|
875
876
|
};
|
|
876
877
|
g2.addEventListener("popstate", onPopState);
|
|
877
878
|
registerPatch("popstate", () => {
|
|
@@ -2222,13 +2223,13 @@ function addBreadcrumb(input, hint) {
|
|
|
2222
2223
|
if (!client) return;
|
|
2223
2224
|
client.addBreadcrumb(normalizeBreadcrumb(input), hint);
|
|
2224
2225
|
}
|
|
2225
|
-
function addNavigationBreadcrumb(from, to) {
|
|
2226
|
+
function addNavigationBreadcrumb(from, to, operation = "push") {
|
|
2226
2227
|
addBreadcrumb({
|
|
2227
2228
|
type: "navigation",
|
|
2228
2229
|
category: "history",
|
|
2229
2230
|
level: "info",
|
|
2230
2231
|
message: null,
|
|
2231
|
-
data: { from, to }
|
|
2232
|
+
data: { from, to, operation }
|
|
2232
2233
|
});
|
|
2233
2234
|
}
|
|
2234
2235
|
|