@hot-updater/sentry-plugin 0.15.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/LICENSE +21 -0
- package/dist/index.cjs +93 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +49 -0
- package/dist/withSentry.d.ts +3 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Sungyu Kang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
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;
|
|
55
|
+
};
|
|
56
|
+
const ensureFilePath = (files, bsaePath, suffix)=>{
|
|
57
|
+
const file = files.find((file)=>file.endsWith(suffix));
|
|
58
|
+
if (!file) return null;
|
|
59
|
+
return external_path_default().join(bsaePath, file);
|
|
60
|
+
};
|
|
61
|
+
const withSentry = (buildFn, config)=>(args)=>{
|
|
62
|
+
const context = buildFn(args);
|
|
63
|
+
return {
|
|
64
|
+
...context,
|
|
65
|
+
build: async (args)=>{
|
|
66
|
+
const result = await context.build(args);
|
|
67
|
+
const sentry = new (cli_default())(null, config);
|
|
68
|
+
const files = await external_fs_default().promises.readdir(result.buildPath, {
|
|
69
|
+
recursive: true
|
|
70
|
+
});
|
|
71
|
+
const bundleMapFile = ensureFilePath(files, result.buildPath, ".bundle.map");
|
|
72
|
+
const hbcMapFile = ensureFilePath(files, result.buildPath, ".hbc.map");
|
|
73
|
+
const bundleFile = ensureFilePath(files, result.buildPath, ".bundle");
|
|
74
|
+
if (!bundleMapFile || !bundleFile) throw new Error("Source map not found. Please enable sourcemap in your build plugin. e.g build: metro({ sourcemap: true })");
|
|
75
|
+
const sourcemapFile = injectDebugIdToHbcMap(bundleMapFile, hbcMapFile);
|
|
76
|
+
await sentry.execute([
|
|
77
|
+
"sourcemaps",
|
|
78
|
+
"upload",
|
|
79
|
+
"--debug-id-reference",
|
|
80
|
+
"--strip-prefix",
|
|
81
|
+
(0, plugin_core_namespaceObject.getCwd)(),
|
|
82
|
+
sourcemapFile,
|
|
83
|
+
bundleFile
|
|
84
|
+
], true);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
var __webpack_export_target__ = exports;
|
|
90
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
91
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
92
|
+
value: true
|
|
93
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./withSentry";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__ from "@hot-updater/plugin-core";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__sentry_cli_3975d286__ from "@sentry/cli";
|
|
5
|
+
const injectDebugIdToHbcMap = (jsMapPath, hbcMapPath)=>{
|
|
6
|
+
if (!hbcMapPath) return jsMapPath;
|
|
7
|
+
const jsMap = JSON.parse(__WEBPACK_EXTERNAL_MODULE_fs__["default"].readFileSync(jsMapPath, "utf8"));
|
|
8
|
+
const debugId = jsMap.debug_id;
|
|
9
|
+
const hbcMap = JSON.parse(__WEBPACK_EXTERNAL_MODULE_fs__["default"].readFileSync(hbcMapPath, "utf8"));
|
|
10
|
+
hbcMap.debug_id = debugId;
|
|
11
|
+
__WEBPACK_EXTERNAL_MODULE_fs__["default"].writeFileSync(hbcMapPath, JSON.stringify(hbcMap, null, 2));
|
|
12
|
+
__WEBPACK_EXTERNAL_MODULE_fs__["default"].unlinkSync(jsMapPath);
|
|
13
|
+
__WEBPACK_EXTERNAL_MODULE_fs__["default"].renameSync(hbcMapPath, jsMapPath);
|
|
14
|
+
return jsMapPath;
|
|
15
|
+
};
|
|
16
|
+
const ensureFilePath = (files, bsaePath, suffix)=>{
|
|
17
|
+
const file = files.find((file)=>file.endsWith(suffix));
|
|
18
|
+
if (!file) return null;
|
|
19
|
+
return __WEBPACK_EXTERNAL_MODULE_path__["default"].join(bsaePath, file);
|
|
20
|
+
};
|
|
21
|
+
const withSentry = (buildFn, config)=>(args)=>{
|
|
22
|
+
const context = buildFn(args);
|
|
23
|
+
return {
|
|
24
|
+
...context,
|
|
25
|
+
build: async (args)=>{
|
|
26
|
+
const result = await context.build(args);
|
|
27
|
+
const sentry = new __WEBPACK_EXTERNAL_MODULE__sentry_cli_3975d286__["default"](null, config);
|
|
28
|
+
const files = await __WEBPACK_EXTERNAL_MODULE_fs__["default"].promises.readdir(result.buildPath, {
|
|
29
|
+
recursive: true
|
|
30
|
+
});
|
|
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: metro({ sourcemap: true })");
|
|
35
|
+
const sourcemapFile = injectDebugIdToHbcMap(bundleMapFile, hbcMapFile);
|
|
36
|
+
await sentry.execute([
|
|
37
|
+
"sourcemaps",
|
|
38
|
+
"upload",
|
|
39
|
+
"--debug-id-reference",
|
|
40
|
+
"--strip-prefix",
|
|
41
|
+
(0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.getCwd)(),
|
|
42
|
+
sourcemapFile,
|
|
43
|
+
bundleFile
|
|
44
|
+
], true);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export { withSentry };
|
|
@@ -0,0 +1,3 @@
|
|
|
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;
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hot-updater/sentry-plugin",
|
|
3
|
+
"version": "0.15.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "React Native OTA solution for self-hosted",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"package.json"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react-native",
|
|
22
|
+
"react-native-code-push",
|
|
23
|
+
"code-push",
|
|
24
|
+
"eas",
|
|
25
|
+
"eas-update",
|
|
26
|
+
"expo",
|
|
27
|
+
"expo-update",
|
|
28
|
+
"self-hosted"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": "https://github.com/gronxb/hot-updater",
|
|
32
|
+
"author": "gronxb <gron1gh1@gmail.com> (https://github.com/gronxb)",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/gronxb/hot-updater/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/gronxb/hot-updater#readme",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@hot-updater/core": "0.15.1",
|
|
42
|
+
"@hot-updater/plugin-core": "0.15.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@sentry/cli": "^2.43.0",
|
|
46
|
+
"@types/node": "^20.9.4"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@sentry/cli": ">=1.51.1"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "rslib build",
|
|
53
|
+
"test:type": "tsc --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|