sentry-uniapp 1.0.4 → 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 -92
- 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 -92
- 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,8 +14,6 @@ var currentSdk = {
|
|
|
16
14
|
getSystemInfo: function () {
|
|
17
15
|
},
|
|
18
16
|
};
|
|
19
|
-
// tslint:disable-next-line:no-implicit-dependencies no-var-requires
|
|
20
|
-
var fetch = require('@system.fetch');
|
|
21
17
|
/**
|
|
22
18
|
* 获取跨平台的 SDK
|
|
23
19
|
*/
|
|
@@ -43,93 +39,9 @@ var getSDK = function () {
|
|
|
43
39
|
else if (typeof swan === "object") {
|
|
44
40
|
currentSdk = swan;
|
|
45
41
|
}
|
|
46
|
-
else if (typeof fetch === 'object') {
|
|
47
|
-
// 针对快应用的兼容性封装
|
|
48
|
-
globalCopy.getCurrentPages = function () {
|
|
49
|
-
var e_1, _a;
|
|
50
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
51
|
-
var router = require('@system.router');
|
|
52
|
-
var stacks = router.getPages();
|
|
53
|
-
var ret = [];
|
|
54
|
-
try {
|
|
55
|
-
for (var stacks_1 = tslib_1.__values(stacks), stacks_1_1 = stacks_1.next(); !stacks_1_1.done; stacks_1_1 = stacks_1.next()) {
|
|
56
|
-
var route = stacks_1_1.value;
|
|
57
|
-
ret.push({
|
|
58
|
-
route: route.path,
|
|
59
|
-
options: {},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
64
|
-
finally {
|
|
65
|
-
try {
|
|
66
|
-
if (stacks_1_1 && !stacks_1_1.done && (_a = stacks_1.return)) _a.call(stacks_1);
|
|
67
|
-
}
|
|
68
|
-
finally { if (e_1) throw e_1.error; }
|
|
69
|
-
}
|
|
70
|
-
return ret;
|
|
71
|
-
};
|
|
72
|
-
currentSdk.request = fetch.fetch;
|
|
73
|
-
currentSdk.getSystemInfo = function () {
|
|
74
|
-
return new Promise(function (resolve, reject) {
|
|
75
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
76
|
-
var app = require('@system.app');
|
|
77
|
-
var appInfo = app.getInfo();
|
|
78
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
79
|
-
var device = require('@system.device');
|
|
80
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
81
|
-
var battery = require('@system.battery');
|
|
82
|
-
var ret = {
|
|
83
|
-
version: appInfo.versionName,
|
|
84
|
-
battery: 0,
|
|
85
|
-
batteryLevel: 0,
|
|
86
|
-
currentBattery: 0,
|
|
87
|
-
appName: appInfo.name,
|
|
88
|
-
system: '',
|
|
89
|
-
model: String,
|
|
90
|
-
brand: String,
|
|
91
|
-
platform: String,
|
|
92
|
-
screenHeight: Number,
|
|
93
|
-
screenWidth: Number,
|
|
94
|
-
statusBarHeight: Number,
|
|
95
|
-
language: String,
|
|
96
|
-
windowWidth: Number,
|
|
97
|
-
windowHeight: Number,
|
|
98
|
-
fontSizeSetting: '',
|
|
99
|
-
};
|
|
100
|
-
device.getInfo({
|
|
101
|
-
// tslint:disable-next-line:no-shadowed-variable
|
|
102
|
-
success: function (deviceInfo) {
|
|
103
|
-
ret.language = deviceInfo.language;
|
|
104
|
-
ret.brand = deviceInfo.brand;
|
|
105
|
-
ret.model = deviceInfo.model;
|
|
106
|
-
ret.platform = deviceInfo.platformVersionName;
|
|
107
|
-
ret.screenHeight = deviceInfo.screenHeight;
|
|
108
|
-
ret.screenWidth = deviceInfo.screenWidth;
|
|
109
|
-
ret.statusBarHeight = deviceInfo.statusBarHeight;
|
|
110
|
-
ret.windowHeight = deviceInfo.windowHeight;
|
|
111
|
-
ret.windowWidth = deviceInfo.windowWidth;
|
|
112
|
-
ret.system = deviceInfo.osType + " " + deviceInfo.osVersionName;
|
|
113
|
-
battery.getStatus({
|
|
114
|
-
success: function (batteryStatus) {
|
|
115
|
-
ret.currentBattery = batteryStatus.level;
|
|
116
|
-
resolve(ret);
|
|
117
|
-
},
|
|
118
|
-
fail: function (e) {
|
|
119
|
-
reject(e);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
fail: function (e) {
|
|
124
|
-
reject(e);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
42
|
else {
|
|
131
43
|
// tslint:disable-next-line:no-console
|
|
132
|
-
console.log("sentry-uniapp
|
|
44
|
+
console.log("sentry-uniapp 暂不支持此平台, 快应用请使用 sentry-quickapp");
|
|
133
45
|
}
|
|
134
46
|
return currentSdk;
|
|
135
47
|
};
|
|
@@ -159,9 +71,6 @@ var getAppName = function () {
|
|
|
159
71
|
else if (typeof swan === "object") {
|
|
160
72
|
currentAppName = "swan";
|
|
161
73
|
}
|
|
162
|
-
else if (typeof fetch === "object") {
|
|
163
|
-
currentAppName = "quickapp";
|
|
164
|
-
}
|
|
165
74
|
return currentAppName;
|
|
166
75
|
};
|
|
167
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"]}
|