sentry-uniapp 1.0.5 → 1.0.6
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 +2 -0
- package/dist/crossPlatform.d.ts +1 -5
- package/dist/crossPlatform.d.ts.map +1 -1
- package/dist/crossPlatform.js +1 -102
- package/dist/crossPlatform.js.map +1 -1
- package/dist/sentry-uniapp.min.js +2 -2
- 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/crossPlatform.d.ts +1 -5
- package/esm/crossPlatform.d.ts.map +1 -1
- package/esm/crossPlatform.js +1 -102
- package/esm/crossPlatform.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/README.md
CHANGED
package/dist/crossPlatform.d.ts
CHANGED
|
@@ -12,11 +12,7 @@ interface SDK {
|
|
|
12
12
|
onMemoryWarning?: Function;
|
|
13
13
|
getLaunchOptionsSync?: Function;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* 小程序平台 接口
|
|
17
|
-
*/
|
|
18
|
-
declare type AppName = "uniapp" | "wechat" | "alipay" | "bytedance" | "dingtalk" | "qq" | "swan" | "quickapp" | "unknown";
|
|
19
15
|
declare const sdk: SDK;
|
|
20
|
-
declare const appName:
|
|
16
|
+
declare const appName: "uniapp" | "wechat" | "alipay" | "bytedance" | "dingtalk" | "qq" | "swan" | "unknown";
|
|
21
17
|
export { sdk, appName };
|
|
22
18
|
//# sourceMappingURL=crossPlatform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossPlatform.d.ts","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"
|
|
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;AAE7B,OAAO,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC"}
|
package/dist/crossPlatform.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.appName = exports.sdk = void 0;
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var globalCopy = global;
|
|
5
3
|
var currentSdk = {
|
|
6
4
|
// tslint:disable-next-line: no-empty
|
|
7
5
|
request: function () {
|
|
@@ -16,26 +14,6 @@ var currentSdk = {
|
|
|
16
14
|
getSystemInfo: function () {
|
|
17
15
|
},
|
|
18
16
|
};
|
|
19
|
-
var quickApp;
|
|
20
|
-
var router;
|
|
21
|
-
var app;
|
|
22
|
-
var device;
|
|
23
|
-
var battery;
|
|
24
|
-
try {
|
|
25
|
-
// tslint:disable-next-line:no-implicit-dependencies no-var-requires
|
|
26
|
-
quickApp = require('@system.fetch');
|
|
27
|
-
// tslint:disable-next-line:no-implicit-dependencies no-var-requires
|
|
28
|
-
router = require('@system.router');
|
|
29
|
-
// tslint:disable-next-line:no-implicit-dependencies no-var-requires
|
|
30
|
-
app = require('@system.app');
|
|
31
|
-
// tslint:disable-next-line:no-implicit-dependencies no-var-requires
|
|
32
|
-
device = require('@system.device');
|
|
33
|
-
// tslint:disable-next-line:no-implicit-dependencies no-var-requires
|
|
34
|
-
battery = require('@system.battery');
|
|
35
|
-
}
|
|
36
|
-
catch (_a) {
|
|
37
|
-
quickApp = undefined;
|
|
38
|
-
}
|
|
39
17
|
/**
|
|
40
18
|
* 获取跨平台的 SDK
|
|
41
19
|
*/
|
|
@@ -61,85 +39,9 @@ var getSDK = function () {
|
|
|
61
39
|
else if (typeof swan === "object") {
|
|
62
40
|
currentSdk = swan;
|
|
63
41
|
}
|
|
64
|
-
else if (typeof quickApp === 'object') {
|
|
65
|
-
// 针对快应用的兼容性封装
|
|
66
|
-
globalCopy.getCurrentPages = function () {
|
|
67
|
-
var e_1, _a;
|
|
68
|
-
var stacks = router.getPages();
|
|
69
|
-
var ret = [];
|
|
70
|
-
try {
|
|
71
|
-
for (var stacks_1 = tslib_1.__values(stacks), stacks_1_1 = stacks_1.next(); !stacks_1_1.done; stacks_1_1 = stacks_1.next()) {
|
|
72
|
-
var route = stacks_1_1.value;
|
|
73
|
-
ret.push({
|
|
74
|
-
route: route.path,
|
|
75
|
-
options: {},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
80
|
-
finally {
|
|
81
|
-
try {
|
|
82
|
-
if (stacks_1_1 && !stacks_1_1.done && (_a = stacks_1.return)) _a.call(stacks_1);
|
|
83
|
-
}
|
|
84
|
-
finally { if (e_1) throw e_1.error; }
|
|
85
|
-
}
|
|
86
|
-
return ret;
|
|
87
|
-
};
|
|
88
|
-
currentSdk.request = quickApp.fetch;
|
|
89
|
-
currentSdk.getSystemInfo = function () {
|
|
90
|
-
return new Promise(function (resolve, reject) {
|
|
91
|
-
var appInfo = app.getInfo();
|
|
92
|
-
var ret = {
|
|
93
|
-
version: appInfo.versionName,
|
|
94
|
-
battery: 0,
|
|
95
|
-
batteryLevel: 0,
|
|
96
|
-
currentBattery: 0,
|
|
97
|
-
appName: appInfo.name,
|
|
98
|
-
system: '',
|
|
99
|
-
model: String,
|
|
100
|
-
brand: String,
|
|
101
|
-
platform: String,
|
|
102
|
-
screenHeight: Number,
|
|
103
|
-
screenWidth: Number,
|
|
104
|
-
statusBarHeight: Number,
|
|
105
|
-
language: String,
|
|
106
|
-
windowWidth: Number,
|
|
107
|
-
windowHeight: Number,
|
|
108
|
-
fontSizeSetting: '',
|
|
109
|
-
};
|
|
110
|
-
device.getInfo({
|
|
111
|
-
// tslint:disable-next-line:no-shadowed-variable
|
|
112
|
-
success: function (deviceInfo) {
|
|
113
|
-
ret.language = deviceInfo.language;
|
|
114
|
-
ret.brand = deviceInfo.brand;
|
|
115
|
-
ret.model = deviceInfo.model;
|
|
116
|
-
ret.platform = deviceInfo.platformVersionName;
|
|
117
|
-
ret.screenHeight = deviceInfo.screenHeight;
|
|
118
|
-
ret.screenWidth = deviceInfo.screenWidth;
|
|
119
|
-
ret.statusBarHeight = deviceInfo.statusBarHeight;
|
|
120
|
-
ret.windowHeight = deviceInfo.windowHeight;
|
|
121
|
-
ret.windowWidth = deviceInfo.windowWidth;
|
|
122
|
-
ret.system = deviceInfo.osType + " " + deviceInfo.osVersionName;
|
|
123
|
-
battery.getStatus({
|
|
124
|
-
success: function (batteryStatus) {
|
|
125
|
-
ret.currentBattery = batteryStatus.level;
|
|
126
|
-
resolve(ret);
|
|
127
|
-
},
|
|
128
|
-
fail: function (e) {
|
|
129
|
-
reject(e);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
fail: function (e) {
|
|
134
|
-
reject(e);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
42
|
else {
|
|
141
43
|
// tslint:disable-next-line:no-console
|
|
142
|
-
console.log("sentry-uniapp
|
|
44
|
+
console.log("sentry-uniapp 暂不支持此平台, 快应用请使用 sentry-quickapp");
|
|
143
45
|
}
|
|
144
46
|
return currentSdk;
|
|
145
47
|
};
|
|
@@ -169,9 +71,6 @@ var getAppName = function () {
|
|
|
169
71
|
else if (typeof swan === "object") {
|
|
170
72
|
currentAppName = "swan";
|
|
171
73
|
}
|
|
172
|
-
else if (typeof quickApp === "object") {
|
|
173
|
-
currentAppName = "quickapp";
|
|
174
|
-
}
|
|
175
74
|
return currentAppName;
|
|
176
75
|
};
|
|
177
76
|
var sdk = getSDK();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossPlatform.js","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"
|
|
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,GAAG,CAAC;KAClB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,UAAU,GAAG,IAAI,CAAC;KACnB;SAAM;QACL,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;KAC9D;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF;;GAEG;AACH,IAAM,UAAU,GAAG;IACjB,IAAI,cAAc,GAAY,SAAS,CAAC;IAExC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,WAAW,CAAC;KAC9B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,UAAU,CAAC;KAC7B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,IAAI,CAAC;KACvB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,cAAc,GAAG,MAAM,CAAC;KACzB;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,IAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AAGb,kBAAG;AAFX,IAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAEhB,0BAAO","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 = uni;\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\nexport {sdk, appName};\n"]}
|