@granite-js/plugin-sentry 0.1.31 → 0.1.33
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/CHANGELOG.md +16 -0
- package/dist/index.cjs +15 -14
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +8 -11
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @granite-js/plugin-sentry
|
|
2
2
|
|
|
3
|
+
## 0.1.33
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @granite-js/plugin-core@0.1.33
|
|
8
|
+
- @granite-js/utils@0.1.33
|
|
9
|
+
|
|
10
|
+
## 0.1.32
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 7572713: bump version up babel
|
|
15
|
+
- Updated dependencies [7572713]
|
|
16
|
+
- @granite-js/plugin-core@0.1.32
|
|
17
|
+
- @granite-js/utils@0.1.32
|
|
18
|
+
|
|
3
19
|
## 0.1.31
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -21,12 +21,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
}) : target, mod));
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
let fs_promises = require("fs/promises");
|
|
25
|
+
fs_promises = __toESM(fs_promises);
|
|
26
|
+
let __granite_js_plugin_core = require("@granite-js/plugin-core");
|
|
27
|
+
let es_toolkit = require("es-toolkit");
|
|
28
|
+
let crypto = require("crypto");
|
|
29
|
+
let fs = require("fs");
|
|
30
|
+
fs = __toESM(fs);
|
|
31
|
+
let __sentry_cli = require("@sentry/cli");
|
|
32
|
+
__sentry_cli = __toESM(__sentry_cli);
|
|
30
33
|
|
|
31
34
|
//#region src/snippets.ts
|
|
32
35
|
const SENTRY_DEBUG_ID_HOLDER = "SENTRY_DEBUG_ID";
|
|
@@ -34,7 +37,8 @@ function getSentryDebugIdSnippets() {
|
|
|
34
37
|
const debugId = (0, crypto.randomUUID)();
|
|
35
38
|
const debugIdHolder = `${SENTRY_DEBUG_ID_HOLDER}=${debugId}`;
|
|
36
39
|
const sourceMappingComment = `//# debugId=${debugId}`;
|
|
37
|
-
|
|
40
|
+
return {
|
|
41
|
+
injectionScript: `
|
|
38
42
|
// ${debugIdHolder}
|
|
39
43
|
try {
|
|
40
44
|
var globalObject =
|
|
@@ -54,9 +58,7 @@ function getSentryDebugIdSnippets() {
|
|
|
54
58
|
globalObject._sentryDebugIdIdentifier = 'sentry-dbid-${debugId}';
|
|
55
59
|
}
|
|
56
60
|
} catch (e) {}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
injectionScript,
|
|
61
|
+
`,
|
|
60
62
|
sourceMappingComment
|
|
61
63
|
};
|
|
62
64
|
}
|
|
@@ -64,7 +66,7 @@ function getSentryDebugIdSnippets() {
|
|
|
64
66
|
//#endregion
|
|
65
67
|
//#region src/extractSentryDebugId.ts
|
|
66
68
|
function extractSentryDebugId(bundleContent) {
|
|
67
|
-
return bundleContent.match(new RegExp(`${SENTRY_DEBUG_ID_HOLDER}=([\\w-]+)`))?.[1];
|
|
69
|
+
return bundleContent.match(/* @__PURE__ */ new RegExp(`${SENTRY_DEBUG_ID_HOLDER}=([\\w-]+)`))?.[1];
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
//#endregion
|
|
@@ -121,7 +123,7 @@ function createClientActions(options) {
|
|
|
121
123
|
//#region src/sentryPlugin.ts
|
|
122
124
|
const PLUGIN_NAME = "sentry-plugin";
|
|
123
125
|
const PLUGIN_SHIM = { name: PLUGIN_NAME };
|
|
124
|
-
const sentryPlugin = ({ enabled = true
|
|
126
|
+
const sentryPlugin = ({ enabled = true, ...options } = {}) => {
|
|
125
127
|
if (enabled === false) return PLUGIN_SHIM;
|
|
126
128
|
const sentryActions = createClientActions(options);
|
|
127
129
|
return {
|
|
@@ -136,8 +138,7 @@ const sentryPlugin = ({ enabled = true,...options } = {}) => {
|
|
|
136
138
|
}));
|
|
137
139
|
for (const file of files) {
|
|
138
140
|
const { bundle, sourcemap } = file;
|
|
139
|
-
const
|
|
140
|
-
const debugId = await extractSentryDebugId(bundleContent);
|
|
141
|
+
const debugId = await extractSentryDebugId(await fs_promises.readFile(bundle, "utf-8"));
|
|
141
142
|
if (debugId == null) {
|
|
142
143
|
console.error("Cannot find Sentry Debug ID");
|
|
143
144
|
continue;
|
package/dist/index.d.cts
CHANGED
|
@@ -15,13 +15,11 @@ interface BaseSentryPluginOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
enabled?: boolean;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
//#endregion
|
|
20
19
|
//#region src/sentryPlugin.d.ts
|
|
21
20
|
declare const sentryPlugin: ({
|
|
22
21
|
enabled,
|
|
23
22
|
...options
|
|
24
23
|
}?: SentryPluginOptions) => GranitePluginCore;
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
|
-
export { SentryPluginOptions, sentryPlugin as sentry };
|
|
25
|
+
export { type SentryPluginOptions, sentryPlugin as sentry };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,13 +15,11 @@ interface BaseSentryPluginOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
enabled?: boolean;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
//#endregion
|
|
20
19
|
//#region src/sentryPlugin.d.ts
|
|
21
20
|
declare const sentryPlugin: ({
|
|
22
21
|
enabled,
|
|
23
22
|
...options
|
|
24
23
|
}?: SentryPluginOptions) => GranitePluginCore;
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
|
-
export { SentryPluginOptions, sentryPlugin as sentry };
|
|
25
|
+
export { type SentryPluginOptions, sentryPlugin as sentry };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as fs$2 from "fs/promises";
|
|
2
1
|
import * as fs from "fs/promises";
|
|
3
2
|
import { isBuildSuccess } from "@granite-js/plugin-core";
|
|
4
3
|
import { asyncNoop, noop } from "es-toolkit";
|
|
@@ -12,7 +11,8 @@ function getSentryDebugIdSnippets() {
|
|
|
12
11
|
const debugId = randomUUID();
|
|
13
12
|
const debugIdHolder = `${SENTRY_DEBUG_ID_HOLDER}=${debugId}`;
|
|
14
13
|
const sourceMappingComment = `//# debugId=${debugId}`;
|
|
15
|
-
|
|
14
|
+
return {
|
|
15
|
+
injectionScript: `
|
|
16
16
|
// ${debugIdHolder}
|
|
17
17
|
try {
|
|
18
18
|
var globalObject =
|
|
@@ -32,9 +32,7 @@ function getSentryDebugIdSnippets() {
|
|
|
32
32
|
globalObject._sentryDebugIdIdentifier = 'sentry-dbid-${debugId}';
|
|
33
33
|
}
|
|
34
34
|
} catch (e) {}
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
injectionScript,
|
|
35
|
+
`,
|
|
38
36
|
sourceMappingComment
|
|
39
37
|
};
|
|
40
38
|
}
|
|
@@ -42,17 +40,17 @@ function getSentryDebugIdSnippets() {
|
|
|
42
40
|
//#endregion
|
|
43
41
|
//#region src/extractSentryDebugId.ts
|
|
44
42
|
function extractSentryDebugId(bundleContent) {
|
|
45
|
-
return bundleContent.match(new RegExp(`${SENTRY_DEBUG_ID_HOLDER}=([\\w-]+)`))?.[1];
|
|
43
|
+
return bundleContent.match(/* @__PURE__ */ new RegExp(`${SENTRY_DEBUG_ID_HOLDER}=([\\w-]+)`))?.[1];
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
//#endregion
|
|
49
47
|
//#region src/injectSentryDebugId.ts
|
|
50
48
|
async function writeDebugIdInjectedSourcemap(sourcemapPath, debugId) {
|
|
51
49
|
const sourcemapObject = await injectSentryDebugId(sourcemapPath, debugId);
|
|
52
|
-
await fs
|
|
50
|
+
await fs.writeFile(sourcemapPath, JSON.stringify(sourcemapObject, null, 2), "utf-8");
|
|
53
51
|
}
|
|
54
52
|
async function injectSentryDebugId(sourcemapPath, debugId) {
|
|
55
|
-
const sourcemapContent = await fs
|
|
53
|
+
const sourcemapContent = await fs.readFile(sourcemapPath, "utf-8");
|
|
56
54
|
const sourcemapObject = JSON.parse(sourcemapContent);
|
|
57
55
|
sourcemapObject.debugId = debugId;
|
|
58
56
|
return sourcemapObject;
|
|
@@ -99,7 +97,7 @@ function createClientActions(options) {
|
|
|
99
97
|
//#region src/sentryPlugin.ts
|
|
100
98
|
const PLUGIN_NAME = "sentry-plugin";
|
|
101
99
|
const PLUGIN_SHIM = { name: PLUGIN_NAME };
|
|
102
|
-
const sentryPlugin = ({ enabled = true
|
|
100
|
+
const sentryPlugin = ({ enabled = true, ...options } = {}) => {
|
|
103
101
|
if (enabled === false) return PLUGIN_SHIM;
|
|
104
102
|
const sentryActions = createClientActions(options);
|
|
105
103
|
return {
|
|
@@ -114,8 +112,7 @@ const sentryPlugin = ({ enabled = true,...options } = {}) => {
|
|
|
114
112
|
}));
|
|
115
113
|
for (const file of files) {
|
|
116
114
|
const { bundle, sourcemap } = file;
|
|
117
|
-
const
|
|
118
|
-
const debugId = await extractSentryDebugId(bundleContent);
|
|
115
|
+
const debugId = await extractSentryDebugId(await fs.readFile(bundle, "utf-8"));
|
|
119
116
|
if (debugId == null) {
|
|
120
117
|
console.error("Cannot find Sentry Debug ID");
|
|
121
118
|
continue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granite-js/plugin-sentry",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.33",
|
|
5
5
|
"description": "Plugin for integrating Sentry with Granite applications",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -34,13 +34,14 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"
|
|
37
|
+
"@vitest/coverage-v8": "^4.0.12",
|
|
38
|
+
"tsdown": "^0.16.5",
|
|
38
39
|
"typescript": "^5.8.3",
|
|
39
|
-
"vitest": "^
|
|
40
|
+
"vitest": "^4.0.12"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@granite-js/plugin-core": "0.1.
|
|
43
|
-
"@granite-js/utils": "0.1.
|
|
43
|
+
"@granite-js/plugin-core": "0.1.33",
|
|
44
|
+
"@granite-js/utils": "0.1.33",
|
|
44
45
|
"@sentry/cli": "^2.45.0",
|
|
45
46
|
"es-toolkit": "^1.39.8",
|
|
46
47
|
"execa": "^5"
|