@hot-updater/sentry-plugin 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +72 -93
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +49 -47
- package/package.json +4 -4
- package/dist/withSentry.d.ts +0 -3
package/dist/index.cjs
CHANGED
|
@@ -1,95 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(()=>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
})();
|
|
20
|
-
(()=>{
|
|
21
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
-
})();
|
|
23
|
-
(()=>{
|
|
24
|
-
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
-
value: 'Module'
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
-
value: true
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __webpack_exports__ = {};
|
|
34
|
-
__webpack_require__.r(__webpack_exports__);
|
|
35
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
withSentry: ()=>withSentry
|
|
37
|
-
});
|
|
38
|
-
const external_fs_namespaceObject = require("fs");
|
|
39
|
-
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
40
|
-
const external_path_namespaceObject = require("path");
|
|
41
|
-
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
42
|
-
const plugin_core_namespaceObject = require("@hot-updater/plugin-core");
|
|
43
|
-
const cli_namespaceObject = require("@sentry/cli");
|
|
44
|
-
var cli_default = /*#__PURE__*/ __webpack_require__.n(cli_namespaceObject);
|
|
45
|
-
const injectDebugIdToHbcMap = (jsMapPath, hbcMapPath)=>{
|
|
46
|
-
if (!hbcMapPath) return jsMapPath;
|
|
47
|
-
const jsMap = JSON.parse(external_fs_default().readFileSync(jsMapPath, "utf8"));
|
|
48
|
-
const debugId = jsMap.debug_id;
|
|
49
|
-
const hbcMap = JSON.parse(external_fs_default().readFileSync(hbcMapPath, "utf8"));
|
|
50
|
-
hbcMap.debug_id = debugId;
|
|
51
|
-
external_fs_default().writeFileSync(hbcMapPath, JSON.stringify(hbcMap, null, 2));
|
|
52
|
-
external_fs_default().unlinkSync(jsMapPath);
|
|
53
|
-
external_fs_default().renameSync(hbcMapPath, jsMapPath);
|
|
54
|
-
return jsMapPath;
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
55
17
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
const fs = __toESM(require("fs"));
|
|
25
|
+
const path = __toESM(require("path"));
|
|
26
|
+
const __hot_updater_plugin_core = __toESM(require("@hot-updater/plugin-core"));
|
|
27
|
+
const __sentry_cli = __toESM(require("@sentry/cli"));
|
|
28
|
+
|
|
29
|
+
//#region src/withSentry.ts
|
|
30
|
+
const injectDebugIdToHbcMap = (jsMapPath, hbcMapPath) => {
|
|
31
|
+
if (!hbcMapPath) return jsMapPath;
|
|
32
|
+
const jsMap = JSON.parse(fs.default.readFileSync(jsMapPath, "utf8"));
|
|
33
|
+
const debugId = jsMap.debug_id;
|
|
34
|
+
const hbcMap = JSON.parse(fs.default.readFileSync(hbcMapPath, "utf8"));
|
|
35
|
+
hbcMap.debug_id = debugId;
|
|
36
|
+
fs.default.writeFileSync(hbcMapPath, JSON.stringify(hbcMap, null, 2));
|
|
37
|
+
fs.default.unlinkSync(jsMapPath);
|
|
38
|
+
fs.default.renameSync(hbcMapPath, jsMapPath);
|
|
39
|
+
return jsMapPath;
|
|
60
40
|
};
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
41
|
+
const ensureFilePath = (files, bsaePath, suffix) => {
|
|
42
|
+
const file = files.find((file$1) => file$1.endsWith(suffix));
|
|
43
|
+
if (!file) return null;
|
|
44
|
+
return path.default.join(bsaePath, file);
|
|
45
|
+
};
|
|
46
|
+
const withSentry = (buildFn, config) => (args) => {
|
|
47
|
+
const context = buildFn(args);
|
|
48
|
+
return {
|
|
49
|
+
...context,
|
|
50
|
+
build: async (args$1) => {
|
|
51
|
+
const result = await context.build(args$1);
|
|
52
|
+
const sentry = new __sentry_cli.default(null, config);
|
|
53
|
+
const files = await fs.default.promises.readdir(result.buildPath, { recursive: true });
|
|
54
|
+
const bundleMapFile = ensureFilePath(files, result.buildPath, ".bundle.map");
|
|
55
|
+
const hbcMapFile = ensureFilePath(files, result.buildPath, ".hbc.map");
|
|
56
|
+
const bundleFile = ensureFilePath(files, result.buildPath, ".bundle");
|
|
57
|
+
if (!bundleMapFile || !bundleFile) throw new Error("Source map not found. Please enable sourcemap in your build plugin. e.g build: bare({ sourcemap: true })");
|
|
58
|
+
const sourcemapFile = injectDebugIdToHbcMap(bundleMapFile, hbcMapFile);
|
|
59
|
+
await sentry.execute([
|
|
60
|
+
"sourcemaps",
|
|
61
|
+
"upload",
|
|
62
|
+
"--debug-id-reference",
|
|
63
|
+
"--strip-prefix",
|
|
64
|
+
(0, __hot_updater_plugin_core.getCwd)(),
|
|
65
|
+
sourcemapFile,
|
|
66
|
+
bundleFile
|
|
67
|
+
], true);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.withSentry = withSentry;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BasePluginArgs, BuildPlugin } from "@hot-updater/plugin-core";
|
|
2
|
+
import { SentryCliOptions } from "@sentry/cli";
|
|
3
|
+
|
|
4
|
+
//#region src/withSentry.d.ts
|
|
5
|
+
declare const withSentry: (buildFn: (args: BasePluginArgs) => BuildPlugin, config: SentryCliOptions) => (args: BasePluginArgs) => BuildPlugin;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { withSentry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { BasePluginArgs, BuildPlugin } from "@hot-updater/plugin-core";
|
|
2
|
+
import { SentryCliOptions } from "@sentry/cli";
|
|
3
|
+
|
|
4
|
+
//#region src/withSentry.d.ts
|
|
5
|
+
declare const withSentry: (buildFn: (args: BasePluginArgs) => BuildPlugin, config: SentryCliOptions) => (args: BasePluginArgs) => BuildPlugin;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { withSentry };
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { getCwd } from "@hot-updater/plugin-core";
|
|
4
|
+
import SentryCli from "@sentry/cli";
|
|
5
|
+
|
|
6
|
+
//#region src/withSentry.ts
|
|
7
|
+
const injectDebugIdToHbcMap = (jsMapPath, hbcMapPath) => {
|
|
8
|
+
if (!hbcMapPath) return jsMapPath;
|
|
9
|
+
const jsMap = JSON.parse(fs.readFileSync(jsMapPath, "utf8"));
|
|
10
|
+
const debugId = jsMap.debug_id;
|
|
11
|
+
const hbcMap = JSON.parse(fs.readFileSync(hbcMapPath, "utf8"));
|
|
12
|
+
hbcMap.debug_id = debugId;
|
|
13
|
+
fs.writeFileSync(hbcMapPath, JSON.stringify(hbcMap, null, 2));
|
|
14
|
+
fs.unlinkSync(jsMapPath);
|
|
15
|
+
fs.renameSync(hbcMapPath, jsMapPath);
|
|
16
|
+
return jsMapPath;
|
|
15
17
|
};
|
|
16
|
-
const ensureFilePath = (files, bsaePath, suffix)=>{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const ensureFilePath = (files, bsaePath, suffix) => {
|
|
19
|
+
const file = files.find((file$1) => file$1.endsWith(suffix));
|
|
20
|
+
if (!file) return null;
|
|
21
|
+
return path.join(bsaePath, file);
|
|
20
22
|
};
|
|
21
|
-
const withSentry = (buildFn, config)=>(args)=>{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export { withSentry };
|
|
23
|
+
const withSentry = (buildFn, config) => (args) => {
|
|
24
|
+
const context = buildFn(args);
|
|
25
|
+
return {
|
|
26
|
+
...context,
|
|
27
|
+
build: async (args$1) => {
|
|
28
|
+
const result = await context.build(args$1);
|
|
29
|
+
const sentry = new SentryCli(null, config);
|
|
30
|
+
const files = await fs.promises.readdir(result.buildPath, { recursive: true });
|
|
31
|
+
const bundleMapFile = ensureFilePath(files, result.buildPath, ".bundle.map");
|
|
32
|
+
const hbcMapFile = ensureFilePath(files, result.buildPath, ".hbc.map");
|
|
33
|
+
const bundleFile = ensureFilePath(files, result.buildPath, ".bundle");
|
|
34
|
+
if (!bundleMapFile || !bundleFile) throw new Error("Source map not found. Please enable sourcemap in your build plugin. e.g build: bare({ sourcemap: true })");
|
|
35
|
+
const sourcemapFile = injectDebugIdToHbcMap(bundleMapFile, hbcMapFile);
|
|
36
|
+
await sentry.execute([
|
|
37
|
+
"sourcemaps",
|
|
38
|
+
"upload",
|
|
39
|
+
"--debug-id-reference",
|
|
40
|
+
"--strip-prefix",
|
|
41
|
+
getCwd(),
|
|
42
|
+
sourcemapFile,
|
|
43
|
+
bundleFile
|
|
44
|
+
], true);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { withSentry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/sentry-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hot-updater/core": "0.
|
|
42
|
-
"@hot-updater/
|
|
41
|
+
"@hot-updater/plugin-core": "0.18.0",
|
|
42
|
+
"@hot-updater/core": "0.18.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@sentry/cli": "^2.43.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@sentry/cli": ">=1.51.1"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"build": "
|
|
52
|
+
"build": "tsdown",
|
|
53
53
|
"test:type": "tsc --noEmit"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/dist/withSentry.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type BasePluginArgs, type BuildPlugin } from "@hot-updater/plugin-core";
|
|
2
|
-
import type { SentryCliOptions } from "@sentry/cli";
|
|
3
|
-
export declare const withSentry: (buildFn: (args: BasePluginArgs) => BuildPlugin, config: SentryCliOptions) => (args: BasePluginArgs) => BuildPlugin;
|