@granite-js/plugin-sentry 0.1.5 → 0.1.7

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @granite-js/plugin-sentry
2
2
 
3
+ ## 0.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - @granite-js/plugin-core@0.1.7
8
+ - @granite-js/utils@0.1.7
9
+
10
+ ## 0.1.6
11
+
12
+ ### Patch Changes
13
+
14
+ - 24571e5: read bundle content before extracting debug ID
15
+ - @granite-js/plugin-core@0.1.6
16
+ - @granite-js/utils@0.1.6
17
+
3
18
  ## 0.1.5
4
19
 
5
20
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -21,9 +21,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
 
23
23
  //#endregion
24
+ const fs_promises = __toESM(require("fs/promises"));
24
25
  const es_toolkit = __toESM(require("es-toolkit"));
25
26
  const crypto = __toESM(require("crypto"));
26
- const fs_promises = __toESM(require("fs/promises"));
27
27
  const fs = __toESM(require("fs"));
28
28
  const __sentry_cli = __toESM(require("@sentry/cli"));
29
29
 
@@ -136,7 +136,8 @@ const sentryPlugin = ({ enabled = true,...options } = {}) => {
136
136
  }));
137
137
  for (const file of files) {
138
138
  const { bundle, sourcemap } = file;
139
- const debugId = await extractSentryDebugId(bundle);
139
+ const bundleContent = await fs_promises.readFile(bundle, "utf-8");
140
+ const debugId = await extractSentryDebugId(bundleContent);
140
141
  if (debugId == null) {
141
142
  console.error("Cannot find Sentry Debug ID");
142
143
  continue;
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
+ import * as fs$2 from "fs/promises";
2
+ import * as fs from "fs/promises";
1
3
  import { asyncNoop, noop } from "es-toolkit";
2
4
  import { randomUUID } from "crypto";
3
- import * as fs$1 from "fs/promises";
4
- import * as fs from "fs";
5
+ import * as fs$1 from "fs";
5
6
  import SentryCLI from "@sentry/cli";
6
7
 
7
8
  //#region src/snippets.ts
@@ -47,10 +48,10 @@ function extractSentryDebugId(bundleContent) {
47
48
  //#region src/injectSentryDebugId.ts
48
49
  async function writeDebugIdInjectedSourcemap(sourcemapPath, debugId) {
49
50
  const sourcemapObject = await injectSentryDebugId(sourcemapPath, debugId);
50
- await fs$1.writeFile(sourcemapPath, JSON.stringify(sourcemapObject, null, 2), "utf-8");
51
+ await fs$2.writeFile(sourcemapPath, JSON.stringify(sourcemapObject, null, 2), "utf-8");
51
52
  }
52
53
  async function injectSentryDebugId(sourcemapPath, debugId) {
53
- const sourcemapContent = await fs$1.readFile(sourcemapPath, "utf-8");
54
+ const sourcemapContent = await fs$2.readFile(sourcemapPath, "utf-8");
54
55
  const sourcemapObject = JSON.parse(sourcemapContent);
55
56
  sourcemapObject.debugId = debugId;
56
57
  return sourcemapObject;
@@ -60,7 +61,7 @@ async function injectSentryDebugId(sourcemapPath, debugId) {
60
61
  //#region src/resolveHermesBundle.ts
61
62
  function tryResolveHermesBundle(jsBundlePath) {
62
63
  const lookupPath = `${jsBundlePath}.hbc`;
63
- return fs.existsSync(lookupPath) ? {
64
+ return fs$1.existsSync(lookupPath) ? {
64
65
  hbc: lookupPath,
65
66
  sourcemap: `${lookupPath}.map`
66
67
  } : null;
@@ -113,7 +114,8 @@ const sentryPlugin = ({ enabled = true,...options } = {}) => {
113
114
  }));
114
115
  for (const file of files) {
115
116
  const { bundle, sourcemap } = file;
116
- const debugId = await extractSentryDebugId(bundle);
117
+ const bundleContent = await fs.readFile(bundle, "utf-8");
118
+ const debugId = await extractSentryDebugId(bundleContent);
117
119
  if (debugId == null) {
118
120
  console.error("Cannot find Sentry Debug ID");
119
121
  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.5",
4
+ "version": "0.1.7",
5
5
  "description": "Plugin for integrating Sentry with Granite applications",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -33,8 +33,8 @@
33
33
  "vitest": "^3.1.4"
34
34
  },
35
35
  "dependencies": {
36
- "@granite-js/plugin-core": "0.1.5",
37
- "@granite-js/utils": "0.1.5",
36
+ "@granite-js/plugin-core": "0.1.7",
37
+ "@granite-js/utils": "0.1.7",
38
38
  "@sentry/cli": "^2.45.0",
39
39
  "es-toolkit": "^1.38.0",
40
40
  "execa": "^5"