@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 CHANGED
@@ -1,95 +1,74 @@
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;
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
- 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);
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 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: bare({ 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
- exports.withSentry = __webpack_exports__.withSentry;
90
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
91
- "withSentry"
92
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
93
- Object.defineProperty(exports, '__esModule', {
94
- value: true
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;
@@ -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
- export * from "./withSentry";
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 * 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;
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
- const file = files.find((file)=>file.endsWith(suffix));
18
- if (!file) return null;
19
- return __WEBPACK_EXTERNAL_MODULE_path__["default"].join(bsaePath, file);
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
- 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: 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
- (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 };
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.17.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.17.0",
42
- "@hot-updater/plugin-core": "0.17.0"
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": "rslib build",
52
+ "build": "tsdown",
53
53
  "test:type": "tsc --noEmit"
54
54
  }
55
55
  }
@@ -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;