sentry-miniapp 1.4.0 → 1.4.1
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/sentry-miniapp.cjs.js +129 -103
- package/dist/sentry-miniapp.cjs.js.map +1 -1
- package/dist/sentry-miniapp.esm.js +129 -103
- package/dist/sentry-miniapp.esm.js.map +1 -1
- package/dist/sentry-miniapp.umd.js +129 -103
- package/dist/sentry-miniapp.umd.js.map +1 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/crossPlatform.d.ts.map +1 -1
- package/dist/types/eventbuilder.d.ts.map +1 -1
- package/dist/types/helpers.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrations/dedupe.d.ts.map +1 -1
- package/dist/types/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/types/integrations/linkederrors.d.ts.map +1 -1
- package/dist/types/integrations/networkbreadcrumbs.d.ts.map +1 -1
- package/dist/types/integrations/performance.d.ts.map +1 -1
- package/dist/types/integrations/trycatch.d.ts.map +1 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/transports/offlineStore.d.ts.map +1 -1
- package/dist/types/transports/xhr.d.ts.map +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +16 -7
- package/CHANGELOG.md +0 -123
- package/src/.keep +0 -0
- package/src/client.ts +0 -203
- package/src/crossPlatform.ts +0 -407
- package/src/eventbuilder.ts +0 -291
- package/src/helpers.ts +0 -214
- package/src/index.ts +0 -86
- package/src/integrations/dedupe.ts +0 -215
- package/src/integrations/globalhandlers.ts +0 -209
- package/src/integrations/httpcontext.ts +0 -140
- package/src/integrations/index.ts +0 -10
- package/src/integrations/linkederrors.ts +0 -107
- package/src/integrations/networkbreadcrumbs.ts +0 -155
- package/src/integrations/performance.ts +0 -622
- package/src/integrations/rewriteframes.ts +0 -77
- package/src/integrations/router.ts +0 -180
- package/src/integrations/system.ts +0 -135
- package/src/integrations/trycatch.ts +0 -233
- package/src/polyfills.ts +0 -242
- package/src/sdk.ts +0 -182
- package/src/transports/index.ts +0 -3
- package/src/transports/offlineStore.ts +0 -85
- package/src/transports/xhr.ts +0 -68
- package/src/types.ts +0 -129
- package/src/version.ts +0 -3
|
@@ -4938,7 +4938,7 @@ function addBreadcrumb(breadcrumb, hint) {
|
|
|
4938
4938
|
}
|
|
4939
4939
|
isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
|
|
4940
4940
|
}
|
|
4941
|
-
const SDK_VERSION = "1.
|
|
4941
|
+
const SDK_VERSION = "1.4.1";
|
|
4942
4942
|
const SDK_NAME = "sentry.javascript.miniapp";
|
|
4943
4943
|
const getSDK = () => {
|
|
4944
4944
|
let currentSdk = {
|
|
@@ -5126,7 +5126,11 @@ function createMiniappTransport(options) {
|
|
|
5126
5126
|
});
|
|
5127
5127
|
},
|
|
5128
5128
|
fail: (error2) => {
|
|
5129
|
-
reject(
|
|
5129
|
+
reject(
|
|
5130
|
+
new Error(
|
|
5131
|
+
`Network request failed: ${error2.errMsg || error2.errorMessage || error2.message || "Unknown error"}`
|
|
5132
|
+
)
|
|
5133
|
+
);
|
|
5130
5134
|
}
|
|
5131
5135
|
};
|
|
5132
5136
|
if (sdk().request) {
|
|
@@ -5194,7 +5198,7 @@ function getStore() {
|
|
|
5194
5198
|
return typeof storedStr === "string" ? JSON.parse(storedStr) : storedStr;
|
|
5195
5199
|
}
|
|
5196
5200
|
}
|
|
5197
|
-
} catch (
|
|
5201
|
+
} catch (_e) {
|
|
5198
5202
|
}
|
|
5199
5203
|
return [];
|
|
5200
5204
|
}
|
|
@@ -5204,7 +5208,7 @@ function setStore(store) {
|
|
|
5204
5208
|
if (storageApi) {
|
|
5205
5209
|
storageApi(OFFLINE_STORE_KEY, JSON.stringify(store));
|
|
5206
5210
|
}
|
|
5207
|
-
} catch (
|
|
5211
|
+
} catch (_e) {
|
|
5208
5212
|
}
|
|
5209
5213
|
}
|
|
5210
5214
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -5242,10 +5246,12 @@ class MiniappClient extends Client {
|
|
|
5242
5246
|
eventFromException(exception) {
|
|
5243
5247
|
return Promise.resolve({
|
|
5244
5248
|
exception: {
|
|
5245
|
-
values: [
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
+
values: [
|
|
5250
|
+
{
|
|
5251
|
+
type: exception.name || "Error",
|
|
5252
|
+
value: exception.message || String(exception)
|
|
5253
|
+
}
|
|
5254
|
+
]
|
|
5249
5255
|
},
|
|
5250
5256
|
level: "error"
|
|
5251
5257
|
});
|
|
@@ -5316,7 +5322,7 @@ class MiniappClient extends Client {
|
|
|
5316
5322
|
const currentScope = scope || getCurrentScope();
|
|
5317
5323
|
const isolationScope = getIsolationScope();
|
|
5318
5324
|
return super._prepareEvent(event, hint || {}, currentScope, isolationScope);
|
|
5319
|
-
} catch (
|
|
5325
|
+
} catch (_error) {
|
|
5320
5326
|
return Promise.resolve(event);
|
|
5321
5327
|
}
|
|
5322
5328
|
}
|
|
@@ -5438,23 +5444,26 @@ const _GlobalHandlers = class _GlobalHandlers {
|
|
|
5438
5444
|
return;
|
|
5439
5445
|
}
|
|
5440
5446
|
if (sdk().onPageNotFound) {
|
|
5441
|
-
(_b = (_a = sdk()).onPageNotFound) == null ? void 0 : _b.call(
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5447
|
+
(_b = (_a = sdk()).onPageNotFound) == null ? void 0 : _b.call(
|
|
5448
|
+
_a,
|
|
5449
|
+
(res) => {
|
|
5450
|
+
const scope = getCurrentScope();
|
|
5451
|
+
const url = res.path.split("?")[0];
|
|
5452
|
+
scope.setTag("pagenotfound", url);
|
|
5453
|
+
scope.setContext("page_not_found", {
|
|
5454
|
+
path: res.path,
|
|
5455
|
+
query: res.query,
|
|
5456
|
+
isEntryPage: res.isEntryPage
|
|
5457
|
+
});
|
|
5458
|
+
captureException(new Error(`页面无法找到: ${url}`), {
|
|
5459
|
+
level: "warning",
|
|
5460
|
+
mechanism: {
|
|
5461
|
+
type: "onpagenotfound",
|
|
5462
|
+
handled: true
|
|
5463
|
+
}
|
|
5464
|
+
});
|
|
5465
|
+
}
|
|
5466
|
+
);
|
|
5458
5467
|
}
|
|
5459
5468
|
this._onPageNotFoundHandlerInstalled = true;
|
|
5460
5469
|
}
|
|
@@ -5565,7 +5574,7 @@ function wrap$1(fn, options = {}, before) {
|
|
|
5565
5574
|
if (fn.__sentry_wrapped__) {
|
|
5566
5575
|
return fn.__sentry_wrapped__;
|
|
5567
5576
|
}
|
|
5568
|
-
} catch (
|
|
5577
|
+
} catch (_e) {
|
|
5569
5578
|
return fn;
|
|
5570
5579
|
}
|
|
5571
5580
|
const sentryWrapped = function(...args) {
|
|
@@ -5647,7 +5656,7 @@ function fill$1(source, name, replacementFactory) {
|
|
|
5647
5656
|
function getFunctionName(fn) {
|
|
5648
5657
|
try {
|
|
5649
5658
|
return fn && fn.name || "<anonymous>";
|
|
5650
|
-
} catch (
|
|
5659
|
+
} catch (_e) {
|
|
5651
5660
|
return "<anonymous>";
|
|
5652
5661
|
}
|
|
5653
5662
|
}
|
|
@@ -5757,7 +5766,7 @@ const _HttpContext = class _HttpContext {
|
|
|
5757
5766
|
const accountInfo = (_b = (_a = sdk()).getAccountInfoSync) == null ? void 0 : _b.call(_a);
|
|
5758
5767
|
return ((_c = accountInfo.miniProgram) == null ? void 0 : _c.appId) || "unknown";
|
|
5759
5768
|
}
|
|
5760
|
-
} catch (
|
|
5769
|
+
} catch (_e) {
|
|
5761
5770
|
}
|
|
5762
5771
|
return "unknown";
|
|
5763
5772
|
}
|
|
@@ -5771,7 +5780,7 @@ const _HttpContext = class _HttpContext {
|
|
|
5771
5780
|
const accountInfo = (_b = (_a = sdk()).getAccountInfoSync) == null ? void 0 : _b.call(_a);
|
|
5772
5781
|
return ((_c = accountInfo == null ? void 0 : accountInfo.miniProgram) == null ? void 0 : _c.version) || "unknown";
|
|
5773
5782
|
}
|
|
5774
|
-
} catch (
|
|
5783
|
+
} catch (_e) {
|
|
5775
5784
|
}
|
|
5776
5785
|
return "unknown";
|
|
5777
5786
|
}
|
|
@@ -5810,7 +5819,7 @@ const _HttpContext = class _HttpContext {
|
|
|
5810
5819
|
}
|
|
5811
5820
|
});
|
|
5812
5821
|
}
|
|
5813
|
-
} catch (
|
|
5822
|
+
} catch (_e) {
|
|
5814
5823
|
}
|
|
5815
5824
|
return {};
|
|
5816
5825
|
}
|
|
@@ -6003,7 +6012,7 @@ const _System = class _System {
|
|
|
6003
6012
|
scope.setTag("app.version", systemInfo.version);
|
|
6004
6013
|
scope.setTag("language", systemInfo.language);
|
|
6005
6014
|
}
|
|
6006
|
-
} catch (
|
|
6015
|
+
} catch (_e) {
|
|
6007
6016
|
}
|
|
6008
6017
|
}
|
|
6009
6018
|
/**
|
|
@@ -6025,7 +6034,7 @@ const _System = class _System {
|
|
|
6025
6034
|
}
|
|
6026
6035
|
});
|
|
6027
6036
|
}
|
|
6028
|
-
} catch (
|
|
6037
|
+
} catch (_e) {
|
|
6029
6038
|
}
|
|
6030
6039
|
}
|
|
6031
6040
|
/**
|
|
@@ -6048,7 +6057,7 @@ const _System = class _System {
|
|
|
6048
6057
|
}
|
|
6049
6058
|
});
|
|
6050
6059
|
}
|
|
6051
|
-
} catch (
|
|
6060
|
+
} catch (_e) {
|
|
6052
6061
|
}
|
|
6053
6062
|
}
|
|
6054
6063
|
};
|
|
@@ -6132,7 +6141,7 @@ const _Router = class _Router {
|
|
|
6132
6141
|
return currentPage.route || currentPage.__route__ || "";
|
|
6133
6142
|
}
|
|
6134
6143
|
}
|
|
6135
|
-
} catch (
|
|
6144
|
+
} catch (_e) {
|
|
6136
6145
|
}
|
|
6137
6146
|
return "";
|
|
6138
6147
|
}
|
|
@@ -6284,7 +6293,10 @@ const _PerformanceIntegration = class _PerformanceIntegration {
|
|
|
6284
6293
|
const safeTypes = entryTypes.filter((t) => t !== "measure" && t !== "mark");
|
|
6285
6294
|
if (safeTypes.length < entryTypes.length && safeTypes.length > 0) {
|
|
6286
6295
|
observer.observe({ entryTypes: safeTypes });
|
|
6287
|
-
console.warn(
|
|
6296
|
+
console.warn(
|
|
6297
|
+
"[Sentry Performance] Failed to observe all types, falling back to:",
|
|
6298
|
+
safeTypes
|
|
6299
|
+
);
|
|
6288
6300
|
entryTypes.length = 0;
|
|
6289
6301
|
entryTypes.push(...safeTypes);
|
|
6290
6302
|
} else {
|
|
@@ -6370,86 +6382,98 @@ const _PerformanceIntegration = class _PerformanceIntegration {
|
|
|
6370
6382
|
pageReadyTime: entry.pageReadyTime
|
|
6371
6383
|
}
|
|
6372
6384
|
});
|
|
6373
|
-
startSpan(
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6385
|
+
startSpan(
|
|
6386
|
+
{
|
|
6387
|
+
name: `Navigation: ${entry.name}`,
|
|
6388
|
+
op: "navigation",
|
|
6389
|
+
startTime: entry.startTime / 1e3
|
|
6390
|
+
// 转换为秒
|
|
6391
|
+
},
|
|
6392
|
+
(span) => {
|
|
6393
|
+
span.setAttributes({
|
|
6394
|
+
"navigation.name": entry.name,
|
|
6395
|
+
"navigation.duration": entry.duration,
|
|
6396
|
+
"navigation.app_launch_time": entry.appLaunchTime || 0,
|
|
6397
|
+
"navigation.page_ready_time": entry.pageReadyTime || 0,
|
|
6398
|
+
"navigation.first_render_time": entry.firstRenderTime || 0
|
|
6399
|
+
});
|
|
6400
|
+
span.end((entry.startTime + entry.duration) / 1e3);
|
|
6401
|
+
}
|
|
6402
|
+
);
|
|
6388
6403
|
}
|
|
6389
6404
|
/**
|
|
6390
6405
|
* 处理渲染性能条目
|
|
6391
6406
|
*/
|
|
6392
6407
|
_processRenderEntry(entry) {
|
|
6393
|
-
startSpan(
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
+
startSpan(
|
|
6409
|
+
{
|
|
6410
|
+
name: `Render: ${entry.name}`,
|
|
6411
|
+
op: "render",
|
|
6412
|
+
startTime: entry.startTime / 1e3
|
|
6413
|
+
},
|
|
6414
|
+
(span) => {
|
|
6415
|
+
span.setAttributes({
|
|
6416
|
+
"render.name": entry.name,
|
|
6417
|
+
"render.duration": entry.duration,
|
|
6418
|
+
"render.start": entry.renderStart || 0,
|
|
6419
|
+
"render.end": entry.renderEnd || 0,
|
|
6420
|
+
"render.script_start": entry.scriptStart || 0,
|
|
6421
|
+
"render.script_end": entry.scriptEnd || 0
|
|
6422
|
+
});
|
|
6423
|
+
span.end((entry.startTime + entry.duration) / 1e3);
|
|
6424
|
+
}
|
|
6425
|
+
);
|
|
6408
6426
|
}
|
|
6409
6427
|
/**
|
|
6410
6428
|
* 处理资源加载性能条目
|
|
6411
6429
|
*/
|
|
6412
6430
|
_processResourceEntry(entry) {
|
|
6413
|
-
startSpan(
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
"resource.duration": entry.duration,
|
|
6421
|
-
"resource.type": entry.initiatorType || "unknown",
|
|
6422
|
-
"resource.transfer_size": entry.transferSize || 0,
|
|
6423
|
-
"resource.encoded_size": entry.encodedBodySize || 0,
|
|
6424
|
-
"resource.decoded_size": entry.decodedBodySize || 0
|
|
6425
|
-
});
|
|
6426
|
-
if (entry.fetchStart && entry.responseEnd) {
|
|
6431
|
+
startSpan(
|
|
6432
|
+
{
|
|
6433
|
+
name: `Resource: ${entry.name}`,
|
|
6434
|
+
op: "resource",
|
|
6435
|
+
startTime: entry.startTime / 1e3
|
|
6436
|
+
},
|
|
6437
|
+
(span) => {
|
|
6427
6438
|
span.setAttributes({
|
|
6428
|
-
"resource.
|
|
6429
|
-
"resource.
|
|
6430
|
-
"resource.
|
|
6439
|
+
"resource.name": entry.name,
|
|
6440
|
+
"resource.duration": entry.duration,
|
|
6441
|
+
"resource.type": entry.initiatorType || "unknown",
|
|
6442
|
+
"resource.transfer_size": entry.transferSize || 0,
|
|
6443
|
+
"resource.encoded_size": entry.encodedBodySize || 0,
|
|
6444
|
+
"resource.decoded_size": entry.decodedBodySize || 0
|
|
6431
6445
|
});
|
|
6446
|
+
if (entry.fetchStart && entry.responseEnd) {
|
|
6447
|
+
span.setAttributes({
|
|
6448
|
+
"resource.fetch_start": entry.fetchStart,
|
|
6449
|
+
"resource.response_end": entry.responseEnd,
|
|
6450
|
+
"resource.network_time": entry.responseEnd - entry.fetchStart
|
|
6451
|
+
});
|
|
6452
|
+
}
|
|
6453
|
+
span.end((entry.startTime + entry.duration) / 1e3);
|
|
6432
6454
|
}
|
|
6433
|
-
|
|
6434
|
-
});
|
|
6455
|
+
);
|
|
6435
6456
|
}
|
|
6436
6457
|
/**
|
|
6437
6458
|
* 处理用户自定义性能条目
|
|
6438
6459
|
*/
|
|
6439
6460
|
_processUserTimingEntry(entry) {
|
|
6440
6461
|
if (entry.entryType === "measure") {
|
|
6441
|
-
startSpan(
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6462
|
+
startSpan(
|
|
6463
|
+
{
|
|
6464
|
+
name: `Measure: ${entry.name}`,
|
|
6465
|
+
op: "measure",
|
|
6466
|
+
startTime: entry.startTime / 1e3
|
|
6467
|
+
},
|
|
6468
|
+
(span) => {
|
|
6469
|
+
span.setAttributes({
|
|
6470
|
+
"measure.name": entry.name,
|
|
6471
|
+
"measure.duration": entry.duration,
|
|
6472
|
+
"measure.detail": entry.detail ? JSON.stringify(entry.detail) : void 0
|
|
6473
|
+
});
|
|
6474
|
+
span.end((entry.startTime + entry.duration) / 1e3);
|
|
6475
|
+
}
|
|
6476
|
+
);
|
|
6453
6477
|
} else if (entry.entryType === "mark") {
|
|
6454
6478
|
const scope = getCurrentScope();
|
|
6455
6479
|
scope.addBreadcrumb({
|
|
@@ -6745,12 +6769,14 @@ const _NetworkBreadcrumbs = class _NetworkBreadcrumbs {
|
|
|
6745
6769
|
if (dsnMatch && dsnMatch[1]) {
|
|
6746
6770
|
dsnUrl = dsnMatch[1];
|
|
6747
6771
|
}
|
|
6748
|
-
} catch (
|
|
6772
|
+
} catch (_e) {
|
|
6749
6773
|
}
|
|
6750
6774
|
}
|
|
6751
6775
|
}
|
|
6752
6776
|
if (typeof url === "string") {
|
|
6753
|
-
const
|
|
6777
|
+
const hostMatch = url.match(/^https?:\/\/([^:/\n]+)/i);
|
|
6778
|
+
const requestHost = hostMatch && hostMatch[1] ? hostMatch[1] : "";
|
|
6779
|
+
const isSentryRequest = dsnUrl && requestHost === dsnUrl || requestHost === "sentry.io" || requestHost.endsWith(".sentry.io");
|
|
6754
6780
|
if (isSentryRequest) {
|
|
6755
6781
|
return originalRequest.call(this, options);
|
|
6756
6782
|
}
|
|
@@ -6764,7 +6790,7 @@ const _NetworkBreadcrumbs = class _NetworkBreadcrumbs {
|
|
|
6764
6790
|
if (traceNetworkBody && requestData) {
|
|
6765
6791
|
try {
|
|
6766
6792
|
breadcrumbData["request_body"] = typeof requestData === "string" ? requestData : JSON.stringify(requestData);
|
|
6767
|
-
} catch (
|
|
6793
|
+
} catch (_e) {
|
|
6768
6794
|
breadcrumbData["request_body"] = "[Cannot serialize request body]";
|
|
6769
6795
|
}
|
|
6770
6796
|
}
|
|
@@ -6777,7 +6803,7 @@ const _NetworkBreadcrumbs = class _NetworkBreadcrumbs {
|
|
|
6777
6803
|
if (traceNetworkBody && res.data) {
|
|
6778
6804
|
try {
|
|
6779
6805
|
breadcrumbData["response_body"] = typeof res.data === "string" ? res.data : JSON.stringify(res.data);
|
|
6780
|
-
} catch (
|
|
6806
|
+
} catch (_e) {
|
|
6781
6807
|
breadcrumbData["response_body"] = "[Cannot serialize response body]";
|
|
6782
6808
|
}
|
|
6783
6809
|
}
|
|
@@ -6886,7 +6912,7 @@ function showReportDialog(_options = {}) {
|
|
|
6886
6912
|
);
|
|
6887
6913
|
}
|
|
6888
6914
|
function wrap(fn) {
|
|
6889
|
-
return
|
|
6915
|
+
return function(...args) {
|
|
6890
6916
|
return withScope(() => {
|
|
6891
6917
|
try {
|
|
6892
6918
|
return fn.apply(this, args);
|
|
@@ -6895,7 +6921,7 @@ function wrap(fn) {
|
|
|
6895
6921
|
throw error2;
|
|
6896
6922
|
}
|
|
6897
6923
|
});
|
|
6898
|
-
}
|
|
6924
|
+
};
|
|
6899
6925
|
}
|
|
6900
6926
|
function captureFeedback(params) {
|
|
6901
6927
|
const client = getCurrentScope().getClient();
|