sentry-uniapp 1.0.7 → 1.0.9
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/README.md +12 -1
- package/dist/backend.d.ts +1 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js.map +1 -1
- package/dist/crossPlatform.d.ts.map +1 -1
- package/dist/crossPlatform.js +11 -1
- package/dist/crossPlatform.js.map +1 -1
- package/dist/integrations/globalhandlers.d.ts +2 -0
- package/dist/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/integrations/globalhandlers.js +9 -0
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +3 -0
- package/dist/sdk.js.map +1 -1
- package/dist/sentry-uniapp.min.js +1 -1
- package/dist/sentry-uniapp.min.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/esm/backend.d.ts +1 -0
- package/esm/backend.d.ts.map +1 -1
- package/esm/backend.js.map +1 -1
- package/esm/client.js +3 -3
- package/esm/client.js.map +1 -1
- package/esm/crossPlatform.d.ts.map +1 -1
- package/esm/crossPlatform.js +13 -3
- package/esm/crossPlatform.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts +2 -0
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +11 -2
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/router.js +2 -2
- package/esm/integrations/router.js.map +1 -1
- package/esm/integrations/system.js +2 -2
- package/esm/integrations/system.js.map +1 -1
- package/esm/sdk.d.ts +5 -5
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +9 -6
- package/esm/sdk.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/esm/version.js.map +1 -1
- package/package.json +1 -1
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,QAAQ,GAAG,2BAA2B,CAAC;AACvC,QAAA,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.miniapp\";\nexport const SDK_VERSION = \"1.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;AAAa,QAAA,QAAQ,GAAG,2BAA2B,CAAC;AACvC,QAAA,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.miniapp\";\nexport const SDK_VERSION = \"1.0.9\";\n"]}
|
package/esm/backend.d.ts
CHANGED
package/esm/backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/E;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/E;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;IAkBtC;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAe/E;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;CAWhH"}
|
package/esm/backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAA6B,QAAQ,EAAa,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAA6B,QAAQ,EAAa,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO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IACD;;OAEG;IACI,yCAAgB,GAAvB,UAAwB,OAAe,EAAE,KAA+B,EAAE,IAAgB;QAAjD,sBAAA,EAAA,QAAkB,QAAQ,CAAC,IAAI;QACtE,IAAM,kBAAkB,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,SAAS,CAAC;QAC1E,IAAM,KAAK,GAAG,eAAe,CAAC,OAAO,EAAE,kBAAkB,EAAE;YACzD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB;SACjD,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACpB,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;YACzB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SAChC;QACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IACH,qBAAC;AAAD,CAAC,AAtDD,CAAoC,WAAW,GAsD9C","sourcesContent":["import { BaseBackend } from \"@sentry/core\";\nimport { Event, EventHint, Options, Severity, Transport } from \"@sentry/types\";\nimport { addExceptionMechanism, resolvedSyncPromise } from '@sentry/utils';\n\nimport { eventFromString, eventFromUnknownInput } from './eventbuilder';\nimport { XHRTransport } from \"./transports/index\";\n\n/**\n * Configuration options for the Sentry Miniapp SDK.\n * Sentry Miniapp SDK 的配置选项。\n * @see MiniappClient for more information.\n */\nexport interface MiniappOptions extends Options {\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To whitelist certain errors instead, use {@link Options.whitelistUrls}.\n * By default, all errors will be sent.\n */\n blacklistUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.blacklistUrls}.\n * By default, all errors will be sent.\n */\n whitelistUrls?: Array<string | RegExp>;\n\n extraOptions?: Object;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class MiniappBackend extends BaseBackend<MiniappOptions> {\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n\n return new XHRTransport(transportOptions);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: any, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, {\n attachStacktrace: this._options.attachStacktrace,\n });\n addExceptionMechanism(event, {\n handled: true,\n type: 'generic',\n });\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, {\n attachStacktrace: this._options.attachStacktrace,\n });\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n }\n}\n"]}
|
package/esm/client.js
CHANGED
|
@@ -26,7 +26,7 @@ var MiniappClient = /** @class */ (function (_super) {
|
|
|
26
26
|
event.platform = event.platform || "javascript";
|
|
27
27
|
event.sdk = __assign(__assign({}, event.sdk), { name: SDK_NAME, packages: __spread(((event.sdk && event.sdk.packages) || []), [
|
|
28
28
|
{
|
|
29
|
-
name: "npm:sentry-
|
|
29
|
+
name: "npm:sentry-uniapp",
|
|
30
30
|
version: SDK_VERSION
|
|
31
31
|
}
|
|
32
32
|
]), version: SDK_VERSION });
|
|
@@ -41,9 +41,9 @@ var MiniappClient = /** @class */ (function (_super) {
|
|
|
41
41
|
MiniappClient.prototype.showReportDialog = function (options) {
|
|
42
42
|
if (options === void 0) { options = {}; }
|
|
43
43
|
// doesn't work without a document (React Native)
|
|
44
|
-
console.log('sentry-
|
|
44
|
+
console.log('sentry-uniapp 暂未实现该方法', options);
|
|
45
45
|
};
|
|
46
46
|
return MiniappClient;
|
|
47
47
|
}(BaseClient));
|
|
48
48
|
export { MiniappClient };
|
|
49
|
-
//# sourceMappingURL=client.js.map
|
|
49
|
+
//# sourceMappingURL=client.js.map
|
package/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAS,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA6BlD;;;;;GAKG;AACH;IAAmC,iCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;eAC7C,kBAAM,cAAc,EAAE,OAAO,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,KAAK,CAAC,GAAG,yBACJ,KAAK,CAAC,GAAG,KACZ,IAAI,EAAE,QAAQ,EACd,QAAQ,WACH,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC5C;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,WAAW;iBACrB;gBAEH,OAAO,EAAE,WAAW,GACrB,CAAC;QAEF,OAAO,iBAAM,aAAa,YAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,wCAAgB,GAAvB,UAAwB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QACvD,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IACH,oBAAC;AAAD,CAAC,AAzCD,CAAmC,UAAU,GAyC5C","sourcesContent":["import { BaseClient, Scope } from \"@sentry/core\";\nimport { DsnLike, Event, EventHint } from \"@sentry/types\";\n\nimport { MiniappBackend, MiniappOptions } from \"./backend\";\nimport { SDK_NAME, SDK_VERSION } from \"./version\";\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * The Sentry Miniapp SDK Client.\n *\n * @see MiniappOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class MiniappClient extends BaseClient<MiniappBackend, MiniappOptions> {\n /**\n * Creates a new Miniapp SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: MiniappOptions = {}) {\n super(MiniappBackend, options);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || \"javascript\";\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: \"npm:sentry-
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAS,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA6BlD;;;;;GAKG;AACH;IAAmC,iCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;eAC7C,kBAAM,cAAc,EAAE,OAAO,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,KAAK,CAAC,GAAG,yBACJ,KAAK,CAAC,GAAG,KACZ,IAAI,EAAE,QAAQ,EACd,QAAQ,WACH,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC5C;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,WAAW;iBACrB;gBAEH,OAAO,EAAE,WAAW,GACrB,CAAC;QAEF,OAAO,iBAAM,aAAa,YAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,wCAAgB,GAAvB,UAAwB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QACvD,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IACH,oBAAC;AAAD,CAAC,AAzCD,CAAmC,UAAU,GAyC5C","sourcesContent":["import { BaseClient, Scope } from \"@sentry/core\";\nimport { DsnLike, Event, EventHint } from \"@sentry/types\";\n\nimport { MiniappBackend, MiniappOptions } from \"./backend\";\nimport { SDK_NAME, SDK_VERSION } from \"./version\";\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * The Sentry Miniapp SDK Client.\n *\n * @see MiniappOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class MiniappClient extends BaseClient<MiniappBackend, MiniappOptions> {\n /**\n * Creates a new Miniapp SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: MiniappOptions = {}) {\n super(MiniappBackend, options);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || \"javascript\";\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: \"npm:sentry-uniapp\",\n version: SDK_VERSION\n }\n ],\n version: SDK_VERSION\n };\n\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n * 向用户显示报告对话框以将反馈发送到特定事件。---> 小程序上暂时用不到&不考虑。\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n console.log('sentry-uniapp 暂未实现该方法', options);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossPlatform.d.ts","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,UAAU,GAAG;IACX,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,aAAa,EAAE,QAAQ,CAAC;IACxB,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,oBAAoB,CAAC,EAAE,QAAQ,CAAC;IAChC,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,oBAAoB,CAAC,EAAE,QAAQ,CAAC;CACjC;AAkFD,QAAA,MAAM,GAAG,KAAW,CAAC;AACrB,QAAA,MAAM,OAAO,uFAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"crossPlatform.d.ts","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,UAAU,GAAG;IACX,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,aAAa,EAAE,QAAQ,CAAC;IACxB,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,oBAAoB,CAAC,EAAE,QAAQ,CAAC;IAChC,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,oBAAoB,CAAC,EAAE,QAAQ,CAAC;CACjC;AAkFD,QAAA,MAAM,GAAG,KAAW,CAAC;AACrB,QAAA,MAAM,OAAO,uFAAe,CAAC;AAW7B,OAAO,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC"}
|
package/esm/crossPlatform.js
CHANGED
|
@@ -20,7 +20,7 @@ var getSDK = function () {
|
|
|
20
20
|
currentSdk = uni;
|
|
21
21
|
}
|
|
22
22
|
else if (typeof wx === "object") {
|
|
23
|
-
currentSdk =
|
|
23
|
+
currentSdk = wx;
|
|
24
24
|
}
|
|
25
25
|
else if (typeof my === "object") {
|
|
26
26
|
currentSdk = my;
|
|
@@ -39,7 +39,7 @@ var getSDK = function () {
|
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
// tslint:disable-next-line:no-console
|
|
42
|
-
console.log("sentry-
|
|
42
|
+
console.log("sentry-uniapp 暂不支持此平台, 快应用请使用 sentry-quickapp");
|
|
43
43
|
}
|
|
44
44
|
return currentSdk;
|
|
45
45
|
};
|
|
@@ -73,5 +73,15 @@ var getAppName = function () {
|
|
|
73
73
|
};
|
|
74
74
|
var sdk = getSDK();
|
|
75
75
|
var appName = getAppName();
|
|
76
|
+
sdk.getSystemInfo = function () {
|
|
77
|
+
return new Promise(function (resolve, reject) {
|
|
78
|
+
try {
|
|
79
|
+
resolve(sdk.getSystemInfoSync());
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
reject(e);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
76
86
|
export { sdk, appName };
|
|
77
|
-
//# sourceMappingURL=crossPlatform.js.map
|
|
87
|
+
//# sourceMappingURL=crossPlatform.js.map
|
package/esm/crossPlatform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossPlatform.js","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"AAqCA,IAAI,UAAU,GAAQ;IACpB,qCAAqC;IACrC,OAAO,EAAE;IACT,CAAC;IACD,qCAAqC;IACrC,WAAW,EAAE;IACb,CAAC;IACD,qCAAqC;IACrC,iBAAiB,EAAE;IACnB,CAAC;IACD,qCAAqC;IACrC,aAAa,EAAE;IACf,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,IAAM,MAAM,GAAG;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"crossPlatform.js","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"AAqCA,IAAI,UAAU,GAAQ;IACpB,qCAAqC;IACrC,OAAO,EAAE;IACT,CAAC;IACD,qCAAqC;IACrC,WAAW,EAAE;IACb,CAAC;IACD,qCAAqC;IACrC,iBAAiB,EAAE;IACnB,CAAC;IACD,qCAAqC;IACrC,aAAa,EAAE;IACf,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,IAAM,MAAM,GAAG;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ,EAA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AAE;QACnC,cAAc,GAAG,MAAM,CAAC;KACzB;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,IAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AACrB,IAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAE7B,GAAG,CAAC,aAAa,GAAG;IAClB,OAAA,IAAI,OAAO,CAAM,UAAC,OAAO,EAAE,MAAM;QAC/B,IAAI;YACF,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAA;SACjC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,CAAC,CAAC,CAAA;SACV;IACH,CAAC,CAAC;AANF,CAME,CAAA;AAEJ,OAAO,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC","sourcesContent":["declare const uni: any; // uniapp\ndeclare const wx: any; // 微信小程序、微信小游戏\ndeclare const my: any; // 支付宝小程序\ndeclare const tt: any; // 字节跳动小程序\ndeclare const dd: any; // 钉钉小程序\ndeclare const qq: any; // QQ 小程序、QQ 小游戏\ndeclare const swan: any; // 百度小程序\n\n/**\n * 小程序平台 SDK 接口\n */\ninterface SDK {\n request: Function;\n httpRequest?: Function; // 针对钉钉小程序\n getSystemInfo: Function;\n getSystemInfoSync: Function;\n onError?: Function;\n onUnhandledRejection?: Function;\n onPageNotFound?: Function;\n onMemoryWarning?: Function;\n getLaunchOptionsSync?: Function;\n}\n\n/**\n * 小程序平台 接口\n */\ntype AppName =\n | \"uniapp\"\n | \"wechat\"\n | \"alipay\"\n | \"bytedance\"\n | \"dingtalk\"\n | \"qq\"\n | \"swan\"\n | \"quickapp\"\n | \"unknown\";\n\nlet currentSdk: SDK = {\n // tslint:disable-next-line: no-empty\n request: () => {\n },\n // tslint:disable-next-line: no-empty\n httpRequest: () => {\n },\n // tslint:disable-next-line: no-empty\n getSystemInfoSync: () => {\n },\n // tslint:disable-next-line: no-empty\n getSystemInfo: () => {\n },\n};\n\n/**\n * 获取跨平台的 SDK\n */\nconst getSDK = () => {\n if (typeof uni === \"object\") {\n currentSdk = uni;\n } else if (typeof wx === \"object\") {\n currentSdk = wx;\n } else if (typeof my === \"object\") {\n currentSdk = my;\n } else if (typeof tt === \"object\") {\n currentSdk = tt;\n } else if (typeof dd === \"object\") {\n currentSdk = dd;\n } else if (typeof qq === \"object\") {\n currentSdk = qq;\n } else if (typeof swan === \"object\") {\n currentSdk = swan;\n } else {\n // tslint:disable-next-line:no-console\n console.log(\"sentry-uniapp 暂不支持此平台, 快应用请使用 sentry-quickapp\");\n }\n\n return currentSdk;\n};\n\n/**\n * 获取平台名称\n */\nconst getAppName = () => {\n let currentAppName: AppName = \"unknown\";\n\n if (typeof uni === \"object\") {\n currentAppName = \"uniapp\";\n } else if (typeof wx === \"object\") {\n currentAppName = \"wechat\";\n } else if (typeof my === \"object\") {\n currentAppName = \"alipay\";\n } else if (typeof tt === \"object\") {\n currentAppName = \"bytedance\";\n } else if (typeof dd === \"object\") {\n currentAppName = \"dingtalk\";\n } else if (typeof qq === \"object\") {\n currentAppName = \"qq\";\n } else if (typeof swan === \"object\") {\n currentAppName = \"swan\";\n }\n\n return currentAppName;\n};\n\nconst sdk = getSDK();\nconst appName = getAppName();\n\nsdk.getSystemInfo = () =>\n new Promise<any>((resolve, reject) => {\n try {\n resolve(sdk.getSystemInfoSync())\n } catch (e) {\n reject(e)\n }\n })\n\nexport {sdk, appName};\n"]}
|
|
@@ -28,6 +28,8 @@ export declare class GlobalHandlers implements Integration {
|
|
|
28
28
|
private _onMemoryWarningHandlerInstalled;
|
|
29
29
|
/** JSDoc */
|
|
30
30
|
constructor(options?: GlobalHandlersIntegrations);
|
|
31
|
+
/** JSDoc */
|
|
32
|
+
setExtraOptions(extraOptions?: any): void;
|
|
31
33
|
/**
|
|
32
34
|
* @inheritDoc
|
|
33
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalhandlers.d.ts","sourceRoot":"","sources":["../../src/integrations/globalhandlers.ts"],"names":[],"mappings":"A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AE/D,YAAY;IACZ,OAAO,CAAC,+BAA+B,CAAkB;IAEzD,YAAY;IACZ,OAAO,CAAC,gCAAgC,CAAkB;IAE1D,YAAY;gBACO,OAAO,CAAC,EAAE,0BAA0B;IAUvD,YAAY;IACL,eAAe,CAAC,YAAY,CAAC,EAAE,GAAG,GAAG,IAAI;IAShD;;OAEG;IACI,SAAS,IAAI,IAAI;IAwBxB,YAAY;IACZ,OAAO,CAAC,4BAA4B;IAmBpC,YAAY;IACZ,OAAO,CAAC,yCAAyC;IA6BjD,YAAY;IACZ,OAAO,CAAC,mCAAmC;IAoB3C,YAAY;IACZ,OAAO,CAAC,oCAAoC;CAiC7C"}
|
|
@@ -20,6 +20,15 @@ var GlobalHandlers = /** @class */ (function () {
|
|
|
20
20
|
this._onMemoryWarningHandlerInstalled = false;
|
|
21
21
|
this._options = __assign({ onerror: true, onunhandledrejection: true, onpagenotfound: true, onmemorywarning: true }, options);
|
|
22
22
|
}
|
|
23
|
+
/** JSDoc */
|
|
24
|
+
GlobalHandlers.prototype.setExtraOptions = function (extraOptions) {
|
|
25
|
+
if (extraOptions) {
|
|
26
|
+
this._options.onerror = !!extraOptions.onerror;
|
|
27
|
+
this._options.onunhandledrejection = !!extraOptions.onunhandledrejection;
|
|
28
|
+
this._options.onpagenotfound = !!extraOptions.onpagenotfound;
|
|
29
|
+
this._options.onmemorywarning = !!extraOptions.onmemorywarning;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
23
32
|
/**
|
|
24
33
|
* @inheritDoc
|
|
25
34
|
*/
|
|
@@ -51,7 +60,7 @@ var GlobalHandlers = /** @class */ (function () {
|
|
|
51
60
|
var currentHub_1 = getCurrentHub();
|
|
52
61
|
// https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
|
|
53
62
|
sdk.onError(function (err) {
|
|
54
|
-
// console.info("sentry-
|
|
63
|
+
// console.info("sentry-uniapp", error);
|
|
55
64
|
var error = typeof err === 'string' ? new Error(err) : err;
|
|
56
65
|
currentHub_1.captureException(error);
|
|
57
66
|
});
|
|
@@ -131,4 +140,4 @@ var GlobalHandlers = /** @class */ (function () {
|
|
|
131
140
|
return GlobalHandlers;
|
|
132
141
|
}());
|
|
133
142
|
export { GlobalHandlers };
|
|
134
|
-
//# sourceMappingURL=globalhandlers.js.map
|
|
143
|
+
//# sourceMappingURL=globalhandlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalhandlers.js","sourceRoot":"","sources":["../../src/integrations/globalhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAUvC,sBAAsB;AACtB;IA0BE,YAAY;IACZ,wBAAmB,OAAoC;QA1BvD;;WAEG;QACI,SAAI,GAAW,cAAc,CAAC,EAAE,CAAC;QAUxC,YAAY;QACJ,6BAAwB,GAAY,KAAK,CAAC;QAElD,YAAY;QACJ,0CAAqC,GAAY,KAAK,CAAC;QAE/D,YAAY;QACJ,oCAA+B,GAAY,KAAK,CAAC;QAEzD,YAAY;QACJ,qCAAgC,GAAY,KAAK,CAAC;QAIxD,IAAI,CAAC,QAAQ,cACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,cAAc,EAAE,IAAI,EACpB,eAAe,EAAE,IAAI,IAClB,OAAO,CACX,CAAC;IACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"globalhandlers.js","sourceRoot":"","sources":["../../src/integrations/globalhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAUvC,sBAAsB;AACtB;IA0BE,YAAY;IACZ,wBAAmB,OA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ACR,KAAK,EAAE;wBACL,YAAY,GAAG,8BAA8B,CAAC;wBAC9C,MAAM;oBACR;wBACE,OAAO;iBACV;gBAED,YAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnD,YAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;gBAC7C,YAAU,CAAC,cAAc,CAAC,sCAAQ,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,gCAAgC,GAAG,IAAI,CAAC;IAC/C,CAAC;IA5KD;;OAEG;IACW,iBAAE,GAAW,gBAAgB,CAAC;IA0K9C,qBAAC;CAAA,AAnLD,IAmLC;SAnLY,cAAc","sourcesContent":["import { getCurrentHub } from \"@sentry/core\";\nimport { Integration } from \"@sentry/types\";\nimport { logger } from \"@sentry/utils\";\n\nimport { sdk } from \"../crossPlatform\";\n\n/** JSDoc */\ninterface GlobalHandlersIntegrations {\n onerror: boolean;\n onunhandledrejection: boolean;\n onpagenotfound: boolean;\n onmemorywarning: boolean;\n}\n\n/** Global handlers */\nexport class GlobalHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = GlobalHandlers.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"GlobalHandlers\";\n\n /** JSDoc */\n private readonly _options: GlobalHandlersIntegrations;\n\n /** JSDoc */\n private _onErrorHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onUnhandledRejectionHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onPageNotFoundHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onMemoryWarningHandlerInstalled: boolean = false;\n\n /** JSDoc */\n public constructor(options?: GlobalHandlersIntegrations) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n onpagenotfound: true,\n onmemorywarning: true,\n ...options,\n };\n }\n\n /** JSDoc */\n public setExtraOptions(extraOptions?: any): void {\n if (extraOptions) {\n this._options.onerror = !!extraOptions.onerror;\n this._options.onunhandledrejection = !!extraOptions.onunhandledrejection;\n this._options.onpagenotfound = !!extraOptions.onpagenotfound;\n this._options.onmemorywarning = !!extraOptions.onmemorywarning;\n }\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n Error.stackTraceLimit = 50;\n\n if (this._options.onerror) {\n logger.log(\"Global Handler attached: onError\");\n this._installGlobalOnErrorHandler();\n }\n\n if (this._options.onunhandledrejection) {\n logger.log(\"Global Handler attached: onunhandledrejection\");\n this._installGlobalOnUnhandledRejectionHandler();\n }\n\n if (this._options.onpagenotfound) {\n logger.log(\"Global Handler attached: onPageNotFound\");\n this._installGlobalOnPageNotFoundHandler();\n }\n\n if (this._options.onmemorywarning) {\n logger.log(\"Global Handler attached: onMemoryWarning\");\n this._installGlobalOnMemoryWarningHandler();\n }\n }\n\n /** JSDoc */\n private _installGlobalOnErrorHandler(): void {\n if (this._onErrorHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onError) {\n const currentHub = getCurrentHub();\n\n // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html\n sdk.onError((err: string | object) => {\n // console.info(\"sentry-uniapp\", error);\n const error = typeof err === 'string' ? new Error(err) : err\n currentHub.captureException(error);\n });\n }\n\n this._onErrorHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnUnhandledRejectionHandler(): void {\n if (this._onUnhandledRejectionHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onUnhandledRejection) {\n const currentHub = getCurrentHub();\n /** JSDoc */\n interface OnUnhandledRejectionRes {\n reason: string | object;\n promise: Promise<any>;\n }\n\n // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html\n sdk.onUnhandledRejection(\n ({ reason, promise }: OnUnhandledRejectionRes) => {\n // console.log(reason, typeof reason, promise)\n // 为什么官方文档上说 reason 是 string 类型,但是实际返回的确实 object 类型\n const error = typeof reason === 'string' ? new Error(reason) : reason\n currentHub.captureException(error, {\n data: promise,\n });\n }\n );\n }\n\n this._onUnhandledRejectionHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnPageNotFoundHandler(): void {\n if (this._onPageNotFoundHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onPageNotFound) {\n const currentHub = getCurrentHub();\n\n sdk.onPageNotFound((res: { path: string }) => {\n const url = res.path.split(\"?\")[0];\n\n currentHub.setTag(\"pagenotfound\", url);\n currentHub.setExtra(\"message\", JSON.stringify(res));\n currentHub.captureMessage(`页面无法找到: ${url}`);\n });\n }\n\n this._onPageNotFoundHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnMemoryWarningHandler(): void {\n if (this._onMemoryWarningHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onMemoryWarning) {\n const currentHub = getCurrentHub();\n\n sdk.onMemoryWarning(({ level = -1 }: { level: number }) => {\n let levelMessage = \"没有获取到告警级别信息\";\n\n switch (level) {\n case 5:\n levelMessage = \"TRIM_MEMORY_RUNNING_MODERATE\";\n break;\n case 10:\n levelMessage = \"TRIM_MEMORY_RUNNING_LOW\";\n break;\n case 15:\n levelMessage = \"TRIM_MEMORY_RUNNING_CRITICAL\";\n break;\n default:\n return;\n }\n\n currentHub.setTag(\"memory-warning\", String(level));\n currentHub.setExtra(\"message\", levelMessage);\n currentHub.captureMessage(`内存不足告警`);\n });\n }\n\n this._onMemoryWarningHandlerInstalled = true;\n }\n}\n"]}
|
|
@@ -28,7 +28,7 @@ var Router = /** @class */ (function () {
|
|
|
28
28
|
return __assign(__assign({}, event), { extra: __assign(__assign({}, event.extra), { routers: routers }) });
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
31
|
-
console.warn("sentry-
|
|
31
|
+
console.warn("sentry-uniapp get router info fail: " + e);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -42,4 +42,4 @@ var Router = /** @class */ (function () {
|
|
|
42
42
|
return Router;
|
|
43
43
|
}());
|
|
44
44
|
export { Router };
|
|
45
|
-
//# sourceMappingURL=router.js.map
|
|
45
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAUtE,gBAAgB;AAChB;IAcE;;OAEG;IACH,gBAAmB,OAA4B;QAhB/C;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;QAc9B,IAAI,CAAC,QAAQ,cACX,MAAM,EAAE,IAAI,IACT,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBA2BC;QA1BC,uBAAuB,CAAC,UAAC,KAAY;YACnC,IAAI,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;gBAC1C,IAAI,KAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACxB,IAAI;wBACF,IAAM,OAAO,GAAG,eAAe,EAAE,CAAC,GAAG,CACnC,UAAC,KAAyC,IAAK,OAAA,CAAC;4BAC9C,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,OAAO,EAAE,KAAK,CAAC,OAAO;yBACvB,CAAC,EAH6C,CAG7C,CACH,CAAC;wBAEF,6BACK,KAAK,KACR,KAAK,wBACA,KAAK,CAAC,KAAK,KACd,OAAO,SAAA,OAET;qBACH;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,IAAI,CAAC,yCAAuC,CAAG,CAAC,CAAC;qBAC1D;iBACF;aACF;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAhDD;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA8CtC,aAAC;CAAA,AAvDD,IAuDC;SAvDY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\ndeclare const getCurrentPages: any;\n\n/** JSDoc */\ninterface RouterIntegrations {\n enable?: boolean;\n}\n\n/** UserAgent */\nexport class Router implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = Router.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"Router\";\n\n /** JSDoc */\n private readonly _options: RouterIntegrations;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: RouterIntegrations) {\n this._options = {\n enable: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (getCurrentHub().getIntegration(Router)) {\n if (this._options.enable) {\n try {\n const routers = getCurrentPages().map(\n (route: { route: string; options: object }) => ({\n route: route.route,\n options: route.options,\n })\n );\n\n return {\n ...event,\n extra: {\n ...event.extra,\n routers,\n },\n };\n } catch (e) {\n console.warn(`sentry-
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAUtE,gBAAgB;AAChB;IAcE;;OAEG;IACH,gBAAmB,OAA4B;QAhB/C;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;QAc9B,IAAI,CAAC,QAAQ,cACX,MAAM,EAAE,IAAI,IACT,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBA2BC;QA1BC,uBAAuB,CAAC,UAAC,KAAY;YACnC,IAAI,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;gBAC1C,IAAI,KAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACxB,IAAI;wBACF,IAAM,OAAO,GAAG,eAAe,EAAE,CAAC,GAAG,CACnC,UAAC,KAAyC,IAAK,OAAA,CAAC;4BAC9C,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,OAAO,EAAE,KAAK,CAAC,OAAO;yBACvB,CAAC,EAH6C,CAG7C,CACH,CAAC;wBAEF,6BACK,KAAK,KACR,KAAK,wBACA,KAAK,CAAC,KAAK,KACd,OAAO,SAAA,OAET;qBACH;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,IAAI,CAAC,yCAAuC,CAAG,CAAC,CAAC;qBAC1D;iBACF;aACF;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAhDD;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA8CtC,aAAC;CAAA,AAvDD,IAuDC;SAvDY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\ndeclare const getCurrentPages: any;\n\n/** JSDoc */\ninterface RouterIntegrations {\n enable?: boolean;\n}\n\n/** UserAgent */\nexport class Router implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = Router.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"Router\";\n\n /** JSDoc */\n private readonly _options: RouterIntegrations;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: RouterIntegrations) {\n this._options = {\n enable: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (getCurrentHub().getIntegration(Router)) {\n if (this._options.enable) {\n try {\n const routers = getCurrentPages().map(\n (route: { route: string; options: object }) => ({\n route: route.route,\n options: route.options,\n })\n );\n\n return {\n ...event,\n extra: {\n ...event.extra,\n routers,\n },\n };\n } catch (e) {\n console.warn(`sentry-uniapp get router info fail: ${e}`);\n }\n }\n }\n\n return event;\n });\n }\n}\n"]}
|
|
@@ -50,7 +50,7 @@ var System = /** @class */ (function () {
|
|
|
50
50
|
fontSizeSetting: fontSizeSetting, app: app || appName || currentAppName }, systemInfo) }) })];
|
|
51
51
|
case 3:
|
|
52
52
|
e_1 = _b.sent();
|
|
53
|
-
console.warn("sentry-
|
|
53
|
+
console.warn("sentry-uniapp get system info fail: " + e_1);
|
|
54
54
|
return [3 /*break*/, 4];
|
|
55
55
|
case 4: return [2 /*return*/, event];
|
|
56
56
|
}
|
|
@@ -64,4 +64,4 @@ var System = /** @class */ (function () {
|
|
|
64
64
|
return System;
|
|
65
65
|
}());
|
|
66
66
|
export { System };
|
|
67
|
-
//# sourceMappingURL=system.js.map
|
|
67
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/integrations/system.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,gBAAgB;AAChB;IAAA;QACE;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;IA+ElC,CAAC;IAxEC;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBAoEC;QAnEC,uBAAuB,CAAC,UAAO,KAAY;;;;;6BACrC,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAtC,wBAAsC;;;;wBAEnB,qBAAM,GAAG,CAAC,aAAa,EAAE,EAAA;;wBAAtC,UAAU,GAAG,SAAyB;wBAG1C,YAAY,GAkBV,UAAU,aAlBA,EACZ,cAAc,GAiBZ,UAAU,eAjBE,EACd,OAAO,GAgBL,UAAU,QAhBL,EACP,KAAK,GAeH,UAAU,MAfP,EACL,QAAQ,GAcN,UAAU,SAdJ,EACR,KAAK,GAaH,UAAU,MAbP,EACL,UAAU,GAYR,UAAU,WAZF,EACV,QAAQ,GAWN,UAAU,SAXJ,EACR,YAAY,GAUV,UAAU,aAVA,EACZ,WAAW,GAST,UAAU,YATD,EACX,eAAe,GAQb,UAAU,gBARG,EACf,MAAM,GAOJ,UAAU,OAPN,EACN,OAAO,GAML,UAAU,QANL,EACP,YAAY,GAKV,UAAU,aALA,EACZ,WAAW,GAIT,UAAU,YAJD,EACX,GAAG,GAGD,UAAU,IAHT,EACH,OAAO,GAEL,UAAU,QAFL,EACP,eAAe,GACb,UAAU,gBADG,CACF;wBAGT,UAAU,GAAG,WAAW,CAAC;wBACzB,KAAA,OAA8B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAA,EAA9C,UAAU,QAAA,EAAE,aAAa,QAAA,CAAsB;wBAEtD,4CACK,KAAK,KACR,QAAQ,wBACH,KAAK,CAAC,QAAQ,KACjB,MAAM,EAAE;wCACN,KAAK,OAAA;wCACL,aAAa,EAAE,YAAY,IAAI,cAAc,IAAI,OAAO;wCACxD,KAAK,OAAA;wCACL,UAAU,EAAE,UAAU;qCACvB,EACD,EAAE,EAAE;wCACF,IAAI,EAAE,UAAU,IAAI,MAAM;wCAC1B,OAAO,EAAE,aAAa,IAAI,MAAM;qCACjC,EACD,KAAK,aACH,UAAU,YAAA;wCACV,QAAQ,UAAA;wCACR,QAAQ,UAAA;wCACR,YAAY,cAAA;wCACZ,WAAW,aAAA;wCACX,eAAe,iBAAA;wCACf,OAAO,SAAA;wCACP,YAAY,cAAA;wCACZ,WAAW,aAAA;wCACX,eAAe,iBAAA,EACf,GAAG,EAAE,GAAG,IAAI,OAAO,IAAI,cAAc,IAClC,UAAU,SAGjB;;;wBAEF,OAAO,CAAC,IAAI,CAAC,yCAAuC,GAAG,CAAC,CAAC;;4BAI7D,sBAAO,KAAK,EAAC;;;aACd,CAAC,CAAC;IACL,CAAC;IA5ED;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA0EtC,aAAC;CAAA,AAnFD,IAmFC;SAnFY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\nimport { appName as currentAppName, sdk } from \"../crossPlatform\";\nimport { SDK_VERSION } from \"../version\";\n\n/** UserAgent */\nexport class System implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = System.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"System\";\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event) => {\n if (getCurrentHub().getIntegration(System)) {\n try {\n const systemInfo = await sdk.getSystemInfo()\n\n const {\n batteryLevel, // 微信小程序\n currentBattery, // 支付宝小程序、 钉钉小程序\n battery, // 字节跳动小程序\n brand,\n language,\n model,\n pixelRatio,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n system,\n version,\n windowHeight,\n windowWidth,\n app, // 支付宝小程序\n appName, // 字节跳动小程序\n fontSizeSetting, // 支付宝小程序、 钉钉小程序、微信小程序\n } = systemInfo;\n\n // tslint:disable-next-line:variable-name\n const SDKVersion = SDK_VERSION;\n const [systemName, systemVersion] = system.split(\" \");\n\n return {\n ...event,\n contexts: {\n ...event.contexts,\n device: {\n brand,\n battery_level: batteryLevel || currentBattery || battery,\n model,\n screen_dpi: pixelRatio\n },\n os: {\n name: systemName || system,\n version: systemVersion || system\n },\n extra: {\n SDKVersion,\n language,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n version,\n windowHeight,\n windowWidth,\n fontSizeSetting,\n app: app || appName || currentAppName,\n ...systemInfo,\n }\n }\n };\n } catch (e) {\n console.warn(`sentry-
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/integrations/system.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,gBAAgB;AAChB;IAAA;QACE;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;IA+ElC,CAAC;IAxEC;;OAEG;IACI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,QAAQ,UAAA;wCACR,YAAY,cAAA;wCACZ,WAAW,aAAA;wCACX,eAAe,iBAAA;wCACf,OAAO,SAAA;wCACP,YAAY,cAAA;wCACZ,WAAW,aAAA;wCACX,eAAe,iBAAA,EACf,GAAG,EAAE,GAAG,IAAI,OAAO,IAAI,cAAc,IAClC,UAAU,SAGjB;;;wBAEF,OAAO,CAAC,IAAI,CAAC,yCAAuC,GAAG,CAAC,CAAC;;4BAI7D,sBAAO,KAAK,EAAC;;;aACd,CAAC,CAAC;IACL,CAAC;IA5ED;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA0EtC,aAAC;CAAA,AAnFD,IAmFC;SAnFY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\nimport { appName as currentAppName, sdk } from \"../crossPlatform\";\nimport { SDK_VERSION } from \"../version\";\n\n/** UserAgent */\nexport class System implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = System.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"System\";\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event) => {\n if (getCurrentHub().getIntegration(System)) {\n try {\n const systemInfo = await sdk.getSystemInfo()\n\n const {\n batteryLevel, // 微信小程序\n currentBattery, // 支付宝小程序、 钉钉小程序\n battery, // 字节跳动小程序\n brand,\n language,\n model,\n pixelRatio,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n system,\n version,\n windowHeight,\n windowWidth,\n app, // 支付宝小程序\n appName, // 字节跳动小程序\n fontSizeSetting, // 支付宝小程序、 钉钉小程序、微信小程序\n } = systemInfo;\n\n // tslint:disable-next-line:variable-name\n const SDKVersion = SDK_VERSION;\n const [systemName, systemVersion] = system.split(\" \");\n\n return {\n ...event,\n contexts: {\n ...event.contexts,\n device: {\n brand,\n battery_level: batteryLevel || currentBattery || battery,\n model,\n screen_dpi: pixelRatio\n },\n os: {\n name: systemName || system,\n version: systemVersion || system\n },\n extra: {\n SDKVersion,\n language,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n version,\n windowHeight,\n windowWidth,\n fontSizeSetting,\n app: app || appName || currentAppName,\n ...systemInfo,\n }\n }\n };\n } catch (e) {\n console.warn(`sentry-uniapp get system info fail: ${e}`);\n }\n }\n\n return event;\n });\n }\n}\n"]}
|
package/esm/sdk.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```
|
|
15
|
-
* import { init } from 'sentry-
|
|
15
|
+
* import { init } from 'sentry-uniapp';
|
|
16
16
|
*
|
|
17
17
|
* init({
|
|
18
18
|
* dsn: '__DSN__',
|
|
@@ -22,7 +22,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```
|
|
25
|
-
* import { configureScope } from 'sentry-
|
|
25
|
+
* import { configureScope } from 'sentry-uniapp';
|
|
26
26
|
*
|
|
27
27
|
* configureScope((scope: Scope) => {
|
|
28
28
|
* scope.setExtra({ battery: 0.7 });
|
|
@@ -33,7 +33,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
|
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* ```
|
|
36
|
-
* import { addBreadcrumb } from 'sentry-
|
|
36
|
+
* import { addBreadcrumb } from 'sentry-uniapp';
|
|
37
37
|
*
|
|
38
38
|
* addBreadcrumb({
|
|
39
39
|
* message: 'My Breadcrumb',
|
|
@@ -43,7 +43,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
|
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* ```
|
|
46
|
-
* import * as Sentry from 'sentry-
|
|
46
|
+
* import * as Sentry from 'sentry-uniapp';
|
|
47
47
|
*
|
|
48
48
|
* Sentry.captureMessage('Hello, world!');
|
|
49
49
|
* Sentry.captureException(new Error('Good bye'));
|
|
@@ -96,4 +96,4 @@ export declare function close(timeout?: number): PromiseLike<boolean>;
|
|
|
96
96
|
* @returns The result of wrapped function call.
|
|
97
97
|
*/
|
|
98
98
|
export declare function wrap(fn: Function): any;
|
|
99
|
-
//# sourceMappingURL=sdk.d.ts.map
|
|
99
|
+
//# sourceMappingURL=sdk.d.ts.map
|
package/esm/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,IAAI,gBAAgB,EACjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAiB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,MAAM,EACN,MAAM,EACN,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,mBAAmB,8JAU/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,IAAI,gBAAgB,EACjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAiB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,MAAM,EACN,MAAM,EACN,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,mBAAmB,8JAU/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,cAAmB,GAAG,IAAI,CAevD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAQxE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAM5D;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAM5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,QAAQ,GAAG,GAAG,CAGtC"}
|
package/esm/sdk.js
CHANGED
|
@@ -22,7 +22,7 @@ export var defaultIntegrations = [
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```
|
|
25
|
-
* import { init } from 'sentry-
|
|
25
|
+
* import { init } from 'sentry-uniapp';
|
|
26
26
|
*
|
|
27
27
|
* init({
|
|
28
28
|
* dsn: '__DSN__',
|
|
@@ -32,7 +32,7 @@ export var defaultIntegrations = [
|
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```
|
|
35
|
-
* import { configureScope } from 'sentry-
|
|
35
|
+
* import { configureScope } from 'sentry-uniapp';
|
|
36
36
|
*
|
|
37
37
|
* configureScope((scope: Scope) => {
|
|
38
38
|
* scope.setExtra({ battery: 0.7 });
|
|
@@ -43,7 +43,7 @@ export var defaultIntegrations = [
|
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* ```
|
|
46
|
-
* import { addBreadcrumb } from 'sentry-
|
|
46
|
+
* import { addBreadcrumb } from 'sentry-uniapp';
|
|
47
47
|
*
|
|
48
48
|
* addBreadcrumb({
|
|
49
49
|
* message: 'My Breadcrumb',
|
|
@@ -53,7 +53,7 @@ export var defaultIntegrations = [
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```
|
|
56
|
-
* import * as Sentry from 'sentry-
|
|
56
|
+
* import * as Sentry from 'sentry-uniapp';
|
|
57
57
|
*
|
|
58
58
|
* Sentry.captureMessage('Hello, world!');
|
|
59
59
|
* Sentry.captureException(new Error('Good bye'));
|
|
@@ -74,8 +74,11 @@ export function init(options) {
|
|
|
74
74
|
if (options.defaultIntegrations === undefined) {
|
|
75
75
|
options.defaultIntegrations = defaultIntegrations;
|
|
76
76
|
}
|
|
77
|
-
// https://github.com/uappkit/sentry-
|
|
77
|
+
// https://github.com/uappkit/sentry-uniapp/issues/23
|
|
78
78
|
options.normalizeDepth = options.normalizeDepth || 5;
|
|
79
|
+
if (options.defaultIntegrations) {
|
|
80
|
+
options.defaultIntegrations[3].setExtraOptions(options.extraOptions);
|
|
81
|
+
}
|
|
79
82
|
initAndBind(MiniappClient, options);
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
@@ -142,4 +145,4 @@ export function wrap(fn) {
|
|
|
142
145
|
// tslint:disable-next-line: no-unsafe-any
|
|
143
146
|
return internalWrap(fn)();
|
|
144
147
|
}
|
|
145
|
-
//# sourceMappingURL=sdk.js.map
|
|
148
|
+
//# sourceMappingURL=sdk.js.map
|
package/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,YAAY,IAAI,gBAAgB,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAuB,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,IAAI,IAAI,YAAY,E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AE,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,EAAY;IAC/B,0CAA0C;IAC1C,OAAO,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import {\n getCurrentHub,\n initAndBind,\n Integrations as CoreIntegrations,\n} from \"@sentry/core\";\nimport { resolvedSyncPromise } from \"@sentry/utils\";\n\nimport { MiniappOptions } from \"./backend\";\nimport { MiniappClient, ReportDialogOptions } from \"./client\";\nimport { wrap as internalWrap } from \"./helpers\";\nimport {\n GlobalHandlers,\n IgnoreMpcrawlerErrors,\n LinkedErrors,\n Router,\n System,\n TryCatch,\n} from \"./integrations/index\";\n\nexport const defaultIntegrations = [\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n new TryCatch(),\n new GlobalHandlers(),\n new LinkedErrors(),\n\n new System(),\n new Router(),\n new IgnoreMpcrawlerErrors(),\n];\n\n/**\n * The Sentry Uniapp SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * launching the app. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *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W,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAiC;IAAjC,wBAAA,EAAA,YAAiC;IAChE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,OAAO,CAAC,OAAO,GAAG,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC;KACjD;IACD,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;KAClC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,EAAY;IAC/B,0CAA0C;IAC1C,OAAO,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import {\n getCurrentHub,\n initAndBind,\n Integrations as CoreIntegrations,\n} from \"@sentry/core\";\nimport { resolvedSyncPromise } from \"@sentry/utils\";\n\nimport { MiniappOptions } from \"./backend\";\nimport { MiniappClient, ReportDialogOptions } from \"./client\";\nimport { wrap as internalWrap } from \"./helpers\";\nimport {\n GlobalHandlers,\n IgnoreMpcrawlerErrors,\n LinkedErrors,\n Router,\n System,\n TryCatch,\n} from \"./integrations/index\";\n\nexport const defaultIntegrations = [\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n new TryCatch(),\n new GlobalHandlers(),\n new LinkedErrors(),\n\n new System(),\n new Router(),\n new IgnoreMpcrawlerErrors(),\n];\n\n/**\n * The Sentry Uniapp SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * launching the app. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n * ```\n * import { init } from 'sentry-uniapp';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n * import { configureScope } from 'sentry-uniapp';\n *\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\n * });\n * ```\n *\n * @example\n * ```\n * import { addBreadcrumb } from 'sentry-uniapp';\n *\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n * import * as Sentry from 'sentry-uniapp';\n *\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link MiniappOptions} for documentation on configuration options.\n */\nexport function init(options: MiniappOptions = {}): void {\n // 如果将 options.defaultIntegrations 设置为 false,则不会添加默认集成,否则将在内部将其设置为建议的默认集成。\n // tslint:disable-next-line: strict-comparisons\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n\n // https://github.com/uappkit/sentry-uniapp/issues/23\n options.normalizeDepth = options.normalizeDepth || 5;\n\n if (options.defaultIntegrations) {\n (options.defaultIntegrations[3] as GlobalHandlers).setExtraOptions(options.extraOptions);\n }\n\n initAndBind(MiniappClient, options);\n}\n\n/**\n * Present the user with a report dialog.\n * 向用户显示报告对话框。小程序上暂时不考虑实现该功能。\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n options.eventId = getCurrentHub().lastEventId();\n }\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n client.showReportDialog(options);\n }\n}\n\n/**\n * This is the getter for lastEventId. 获取 lastEventId。\n *\n * @returns The last event id of a captured event.\n */\nexport function lastEventId(): string | undefined {\n return getCurrentHub().lastEventId();\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n * 在发送所有当前事件时会变为 resolved 状态的 promise。如果提供了一个超时时间并且队列需要更长时间来消耗,则 promise 将返回 false。\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function flush(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n return client.flush(timeout);\n }\n return resolvedSyncPromise(false);\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function close(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n return client.close(timeout);\n }\n return resolvedSyncPromise(false);\n}\n\n/**\n * Wrap code within a try/catch block so the SDK is able to capture errors.\n * 在 try / catch 块中包装代码,以便 SDK 能够捕获错误。\n * 实际上是 ./helpers 文件中 warp 方法的进一步封装。\n *\n * @param fn A function to wrap.\n *\n * @returns The result of wrapped function call.\n */\nexport function wrap(fn: Function): any {\n // tslint:disable-next-line: no-unsafe-any\n return internalWrap(fn)();\n}\n"]}
|
package/esm/version.d.ts
CHANGED
package/esm/version.js
CHANGED
package/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,QAAQ,GAAG,2BAA2B,CAAC;AACpD,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.miniapp\";\nexport const SDK_VERSION = \"1.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,QAAQ,GAAG,2BAA2B,CAAC;AACpD,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.miniapp\";\nexport const SDK_VERSION = \"1.0.9\";\n"]}
|
package/package.json
CHANGED