@devkitio/faultlens 1.0.2 → 1.1.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.
@@ -0,0 +1,31 @@
1
+ import { H as HttpErrorContext } from '../http-error-DTUBVanG.js';
2
+ import { E as ErrorMonitor } from '../types-hWS-GSV1.js';
3
+
4
+ interface AxiosLikeInterceptorManager {
5
+ use(onFulfilled?: (value: any) => any, onRejected?: (error: any) => any): number;
6
+ eject(id: number): void;
7
+ }
8
+ interface AxiosLikeClient {
9
+ interceptors: {
10
+ request: AxiosLikeInterceptorManager;
11
+ response: AxiosLikeInterceptorManager;
12
+ };
13
+ }
14
+ interface AxiosRequestConfigLike {
15
+ url?: string;
16
+ baseURL?: string;
17
+ method?: string;
18
+ headers?: unknown;
19
+ [key: string]: unknown;
20
+ }
21
+ interface AxiosHttpErrorContext extends HttpErrorContext {
22
+ error: unknown;
23
+ config?: AxiosRequestConfigLike;
24
+ }
25
+ interface AxiosInstrumentationOptions {
26
+ shouldPropagateTraceContext?: (url: URL) => boolean;
27
+ shouldCaptureHttpError?: (context: AxiosHttpErrorContext) => boolean;
28
+ }
29
+ declare function installAxiosInstrumentation(monitor: ErrorMonitor, client: AxiosLikeClient, options?: AxiosInstrumentationOptions): () => void;
30
+
31
+ export { type AxiosHttpErrorContext, type AxiosInstrumentationOptions, type AxiosLikeClient, type AxiosLikeInterceptorManager, type AxiosRequestConfigLike, installAxiosInstrumentation };
@@ -0,0 +1,123 @@
1
+ import { isHttpSuccessStatus, createHttpErrorContext, defaultShouldCaptureHttpError, captureHttpError } from '../chunk-GKS4FQKU.js';
2
+
3
+ // src/axios/index.ts
4
+ var installations = /* @__PURE__ */ new WeakMap();
5
+ function record(value) {
6
+ return typeof value === "object" && value !== null ? value : void 0;
7
+ }
8
+ function requestUrl(config) {
9
+ const raw = typeof config?.url === "string" ? config.url.trim() : "";
10
+ if (!raw) return void 0;
11
+ const configuredBase = typeof config?.baseURL === "string" ? config.baseURL.trim() : "";
12
+ const browserBase = typeof location !== "undefined" ? location.href : "";
13
+ try {
14
+ return new URL(raw, configuredBase || browserBase || "http://faultlens.invalid");
15
+ } catch {
16
+ return void 0;
17
+ }
18
+ }
19
+ function requestMethod(config) {
20
+ const method = typeof config?.method === "string" ? config.method : "GET";
21
+ return method.trim().toUpperCase().slice(0, 32) || "GET";
22
+ }
23
+ function responseStatus(error) {
24
+ const response = record(error?.response);
25
+ const status = Number(response?.status ?? 0);
26
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : 0;
27
+ }
28
+ function defaultShouldPropagate(url) {
29
+ return typeof location !== "undefined" && url.origin === location.origin;
30
+ }
31
+ function setRequestHeader(config, name, value) {
32
+ const headers = record(config.headers);
33
+ const set = headers?.set;
34
+ if (typeof set === "function") {
35
+ set.call(config.headers, name, value);
36
+ return;
37
+ }
38
+ if (headers) headers[name] = value;
39
+ }
40
+ function installAxiosInstrumentation(monitor, client, options = {}) {
41
+ const existing = installations.get(client);
42
+ if (existing) {
43
+ existing.references += 1;
44
+ return releaseInstallation(client, existing);
45
+ }
46
+ const requestStates = /* @__PURE__ */ new WeakMap();
47
+ const requestInterceptorId = client.interceptors.request.use((config) => {
48
+ const configRecord = record(config);
49
+ const method = requestMethod(configRecord);
50
+ const url = requestUrl(configRecord);
51
+ const span = monitor.startSpan(`HTTP ${method}`, {
52
+ attributes: {
53
+ "http.method": method,
54
+ ...url ? { "url.path": url.pathname.slice(0, 2048) || "/" } : {}
55
+ }
56
+ });
57
+ requestStates.set(config, { method, span, ...url ? { url } : {} });
58
+ if (url && (options.shouldPropagateTraceContext ?? defaultShouldPropagate)(url)) {
59
+ for (const [name, value] of Object.entries(span.toTraceHeaders())) {
60
+ setRequestHeader(config, name, value);
61
+ }
62
+ }
63
+ return config;
64
+ });
65
+ const responseInterceptorId = client.interceptors.response.use(
66
+ (response) => {
67
+ const config = record(response)?.config;
68
+ const configObject = typeof config === "object" && config !== null ? config : void 0;
69
+ const state = configObject ? requestStates.get(configObject) : void 0;
70
+ if (state && configObject) {
71
+ const status = Number(record(response)?.status ?? 0);
72
+ if (Number.isInteger(status) && status > 0) {
73
+ state.span.setAttribute("http.status_code", status);
74
+ }
75
+ state.span.end(isHttpSuccessStatus(status) ? "ok" : "error");
76
+ requestStates.delete(configObject);
77
+ }
78
+ return response;
79
+ },
80
+ (error) => {
81
+ const errorRecord = record(error);
82
+ const configRecord = record(errorRecord?.config);
83
+ const config = configRecord;
84
+ const status = responseStatus(errorRecord);
85
+ const state = config ? requestStates.get(config) : void 0;
86
+ if (state && config) {
87
+ if (status > 0) state.span.setAttribute("http.status_code", status);
88
+ state.span.end(isHttpSuccessStatus(status) ? "ok" : "error");
89
+ requestStates.delete(config);
90
+ }
91
+ const context = createHttpErrorContext(
92
+ status > 0 ? "response" : "network",
93
+ state?.method ?? requestMethod(configRecord),
94
+ state?.url ?? requestUrl(configRecord),
95
+ status
96
+ );
97
+ const shouldCapture = options.shouldCaptureHttpError ? (httpContext) => options.shouldCaptureHttpError?.({
98
+ ...httpContext,
99
+ error,
100
+ ...config ? { config } : {}
101
+ }) === true : defaultShouldCaptureHttpError;
102
+ captureHttpError(monitor, "http.axios", error, context, shouldCapture);
103
+ return Promise.reject(error);
104
+ }
105
+ );
106
+ const installation = { requestInterceptorId, responseInterceptorId, references: 1 };
107
+ installations.set(client, installation);
108
+ return releaseInstallation(client, installation);
109
+ }
110
+ function releaseInstallation(client, installation) {
111
+ let released = false;
112
+ return () => {
113
+ if (released) return;
114
+ released = true;
115
+ installation.references -= 1;
116
+ if (installation.references > 0) return;
117
+ client.interceptors.request.eject(installation.requestInterceptorId);
118
+ client.interceptors.response.eject(installation.responseInterceptorId);
119
+ if (installations.get(client) === installation) installations.delete(client);
120
+ };
121
+ }
122
+
123
+ export { installAxiosInstrumentation };
@@ -0,0 +1,51 @@
1
+ // src/http-error.ts
2
+ var httpInstrumentationErrors = /* @__PURE__ */ new WeakSet();
3
+ function isHttpSuccessStatus(status) {
4
+ return status >= 200 && status < 400;
5
+ }
6
+ function isHttpInstrumentationError(error) {
7
+ return typeof error === "object" && error !== null && httpInstrumentationErrors.has(error);
8
+ }
9
+ function defaultShouldCaptureHttpError(context) {
10
+ return context.kind === "network" || context.status >= 500;
11
+ }
12
+ function createHttpErrorContext(kind, method, url, status) {
13
+ return {
14
+ kind,
15
+ method,
16
+ status,
17
+ ...url ? { path: url.pathname.slice(0, 2048) || "/" } : {}
18
+ };
19
+ }
20
+ function captureHttpError(monitor, mechanism, error, context, shouldCapture = defaultShouldCaptureHttpError) {
21
+ let accepted = false;
22
+ try {
23
+ accepted = shouldCapture(context);
24
+ } catch {
25
+ return;
26
+ }
27
+ if (!accepted) return;
28
+ const normalizedError = error instanceof Error ? error : new Error(
29
+ context.kind === "response" ? `HTTP \u8BF7\u6C42\u8FD4\u56DE ${context.status}` : "HTTP \u8BF7\u6C42\u53D1\u751F\u7F51\u7EDC\u9519\u8BEF"
30
+ );
31
+ httpInstrumentationErrors.add(normalizedError);
32
+ try {
33
+ monitor.captureException(normalizedError, {
34
+ handled: true,
35
+ mechanism,
36
+ tags: {
37
+ method: context.method,
38
+ status: String(context.status)
39
+ },
40
+ context: {
41
+ request: {
42
+ kind: context.kind,
43
+ ...context.path ? { path: context.path } : {}
44
+ }
45
+ }
46
+ });
47
+ } catch {
48
+ }
49
+ }
50
+
51
+ export { captureHttpError, createHttpErrorContext, defaultShouldCaptureHttpError, isHttpInstrumentationError, isHttpSuccessStatus };
@@ -1,4 +1,5 @@
1
- import { createMonitorRuntime, captureHttpError, createHttpErrorContext } from './chunk-ZUSG3UKB.js';
1
+ import { createMonitorRuntime } from './chunk-VTX5KF2X.js';
2
+ import { isHttpSuccessStatus, captureHttpError, createHttpErrorContext } from './chunk-GKS4FQKU.js';
2
3
 
3
4
  // src/browser-queue.ts
4
5
  var DATABASE_NAME = "faultlens";
@@ -219,7 +220,7 @@ function installFetchInstrumentation(monitor, options = {}) {
219
220
  try {
220
221
  const response = await originalFetch.call(target, input, { ...init, headers });
221
222
  span.setAttribute("http.status_code", response.status);
222
- span.end(response.status === 200 ? "ok" : "error");
223
+ span.end(isHttpSuccessStatus(response.status) ? "ok" : "error");
223
224
  captureHttpError(
224
225
  monitor,
225
226
  "http.fetch",
@@ -298,7 +299,7 @@ function installXhrInstrumentation(monitor, options = {}) {
298
299
  if (finished) return;
299
300
  finished = true;
300
301
  if (this.status > 0) span.setAttribute("http.status_code", this.status);
301
- span.end(this.status === 200 ? "ok" : "error");
302
+ span.end(isHttpSuccessStatus(this.status) ? "ok" : "error");
302
303
  captureHttpError(
303
304
  monitor,
304
305
  "http.xhr",
@@ -1,49 +1,4 @@
1
- // src/http-error.ts
2
- var httpInstrumentationErrors = /* @__PURE__ */ new WeakSet();
3
- function isHttpInstrumentationError(error) {
4
- return typeof error === "object" && error !== null && httpInstrumentationErrors.has(error);
5
- }
6
- function defaultShouldCaptureHttpError(context) {
7
- return context.kind === "network" || context.status !== 200;
8
- }
9
- function createHttpErrorContext(kind, method, url, status) {
10
- return {
11
- kind,
12
- method,
13
- status,
14
- ...url ? { path: url.pathname.slice(0, 2048) || "/" } : {}
15
- };
16
- }
17
- function captureHttpError(monitor, mechanism, error, context, shouldCapture = defaultShouldCaptureHttpError) {
18
- let accepted = false;
19
- try {
20
- accepted = shouldCapture(context);
21
- } catch {
22
- return;
23
- }
24
- if (!accepted) return;
25
- const normalizedError = error instanceof Error ? error : new Error(
26
- context.kind === "response" ? `HTTP \u8BF7\u6C42\u8FD4\u56DE ${context.status}` : "HTTP \u8BF7\u6C42\u53D1\u751F\u7F51\u7EDC\u9519\u8BEF"
27
- );
28
- httpInstrumentationErrors.add(normalizedError);
29
- try {
30
- monitor.captureException(normalizedError, {
31
- handled: true,
32
- mechanism,
33
- tags: {
34
- method: context.method,
35
- status: String(context.status)
36
- },
37
- context: {
38
- request: {
39
- kind: context.kind,
40
- ...context.path ? { path: context.path } : {}
41
- }
42
- }
43
- });
44
- } catch {
45
- }
46
- }
1
+ import { isHttpInstrumentationError } from './chunk-GKS4FQKU.js';
47
2
 
48
3
  // ../security/dist/redaction.js
49
4
  var REDACTED = "[\u5DF2\u8131\u654F]";
@@ -458,7 +413,7 @@ function traceContextHeaders(context) {
458
413
  }
459
414
 
460
415
  // src/monitor.ts
461
- var SDK_VERSION = "1.0.2";
416
+ var SDK_VERSION = "1.1.0";
462
417
  var PROTOCOL_VERSION = "1.0";
463
418
  var REVOKED_CREDENTIAL_CODES = /* @__PURE__ */ new Set(["invalid_dsn", "relay_key_revoked", "credential_revoked"]);
464
419
  function eventId() {
@@ -1328,4 +1283,4 @@ function createMonitorRuntime(options, overrides = {}) {
1328
1283
  return monitor;
1329
1284
  }
1330
1285
 
1331
- export { FetchTelemetryTransport, SDK_VERSION, captureHttpError, clientRedact, createHttpErrorContext, createMonitorRuntime, defaultShouldCaptureHttpError, formatTraceParent, parseErrorStack, parseRemoteSdkConfig, parseTelemetryTransportResponse, parseTraceParent, parseTransportResponse, traceContextHeaders };
1286
+ export { FetchTelemetryTransport, SDK_VERSION, clientRedact, createMonitorRuntime, formatTraceParent, parseErrorStack, parseRemoteSdkConfig, parseTelemetryTransportResponse, parseTraceParent, parseTransportResponse, traceContextHeaders };
package/dist/cli/index.js CHANGED
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { realpathSync } from 'fs';
3
- import { lstat, readdir, readFile, writeFile, unlink } from 'fs/promises';
3
+ import { lstat, writeFile, unlink, readdir, readFile } from 'fs/promises';
4
4
  import path from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { randomUUID, createHash } from 'crypto';
7
+ import { promisify } from 'util';
8
+ import { gzip, brotliCompress } from 'zlib';
7
9
 
10
+ var gzipAsync = promisify(gzip);
11
+ var brotliCompressAsync = promisify(brotliCompress);
8
12
  var DEBUG_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
9
13
  var SOURCE_MAP_REFERENCE_PATTERN = /(?:\/\*[#@]\s*sourceMappingURL=.*?\*\/|\/\/[#@]\s*sourceMappingURL=.*?$)/gm;
10
14
  var DEBUG_ID_COMMENT_PATTERN = /^\/\/#\s*debugId=[0-9a-f-]{36}\s*$/gim;
@@ -73,13 +77,16 @@ async function prepareOne(root, absolutePath, dryRun) {
73
77
  const preparedBundle = `${cleanedBundle}
74
78
  ${runtimeInjection(debugId)}
75
79
  `;
80
+ const bundleBody = Buffer.from(preparedBundle, "utf8");
76
81
  if (!dryRun) {
77
82
  await writeFile(absolutePath, body, { mode: 384 });
78
- await writeFile(bundlePath, preparedBundle, { mode: 384 });
83
+ await writeFile(bundlePath, bundleBody, { mode: 384 });
79
84
  }
80
85
  return {
81
86
  absolutePath,
82
87
  relativePath,
88
+ bundleAbsolutePath: bundlePath,
89
+ bundleBody,
83
90
  sha256: createHash("sha256").update(body).digest("hex"),
84
91
  size: body.byteLength,
85
92
  debugId,
@@ -92,6 +99,37 @@ async function prepareSourceMapArtifacts(root, dryRun) {
92
99
  if (!rootStats.isDirectory() || rootStats.isSymbolicLink()) throw new Error("--root \u5FC5\u987B\u662F\u771F\u5B9E\u76EE\u5F55");
93
100
  return Promise.all((await sourceMapFiles(resolvedRoot)).map((file) => prepareOne(resolvedRoot, file, dryRun)));
94
101
  }
102
+ async function compressedSiblingExists(absolutePath) {
103
+ try {
104
+ const stats = await lstat(absolutePath);
105
+ if (!stats.isFile() || stats.isSymbolicLink()) {
106
+ throw new Error(`\u538B\u7F29\u8FD0\u884C\u5236\u54C1\u5FC5\u987B\u662F\u771F\u5B9E\u6587\u4EF6\uFF1A${absolutePath}`);
107
+ }
108
+ return true;
109
+ } catch (error) {
110
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
111
+ return false;
112
+ }
113
+ throw error;
114
+ }
115
+ }
116
+ async function synchronizeCompressedBundles(artifacts, dryRun) {
117
+ const synchronizedBundles = /* @__PURE__ */ new Set();
118
+ for (const artifact of artifacts) {
119
+ if (synchronizedBundles.has(artifact.bundleAbsolutePath)) continue;
120
+ synchronizedBundles.add(artifact.bundleAbsolutePath);
121
+ const gzipPath = `${artifact.bundleAbsolutePath}.gz`;
122
+ const brotliPath = `${artifact.bundleAbsolutePath}.br`;
123
+ if (await compressedSiblingExists(gzipPath)) {
124
+ const compressed = await gzipAsync(artifact.bundleBody);
125
+ if (!dryRun) await writeFile(gzipPath, compressed, { mode: 384 });
126
+ }
127
+ if (await compressedSiblingExists(brotliPath)) {
128
+ const compressed = await brotliCompressAsync(artifact.bundleBody);
129
+ if (!dryRun) await writeFile(brotliPath, compressed, { mode: 384 });
130
+ }
131
+ }
132
+ }
95
133
  async function removeUploadedSourceMaps(artifacts) {
96
134
  for (const artifact of artifacts) await unlink(artifact.absolutePath);
97
135
  }
@@ -99,7 +137,10 @@ async function removeUploadedSourceMaps(artifacts) {
99
137
  // src/cli/index.ts
100
138
  function argument(args, name) {
101
139
  const index = args.indexOf(name);
102
- return index >= 0 ? args[index + 1] : void 0;
140
+ if (index < 0) return void 0;
141
+ const value = args[index + 1];
142
+ if (!value || value.startsWith("--")) throw new Error(`\u7F3A\u5C11 ${name} \u7684\u53C2\u6570\u503C`);
143
+ return value;
103
144
  }
104
145
  function required(value, label) {
105
146
  if (!value) throw new Error(`\u7F3A\u5C11 ${label}`);
@@ -171,7 +212,7 @@ async function upload(config, artifacts) {
171
212
  }
172
213
  console.info(`\u4E0A\u4F20\u5B8C\u6210\uFF1A${artifacts.length} \u4E2A Source Map \u6587\u4EF6`);
173
214
  }
174
- async function verify(config, artifacts) {
215
+ async function verify(config, artifacts, deleteAfterVerify = config.deleteAfterVerify) {
175
216
  const token = required(config.token, "--token \u6216 FAULTLENS_SOURCEMAP_TOKEN");
176
217
  const response = await fetch(`${config.endpoint.replace(/\/$/, "")}/v1/admin/source-maps/verify`, {
177
218
  method: "POST",
@@ -193,7 +234,7 @@ async function verify(config, artifacts) {
193
234
  redirect: "error"
194
235
  });
195
236
  if (!response.ok) throw new Error(`\u5236\u54C1\u6E05\u5355\u6821\u9A8C\u5931\u8D25\uFF0C\u72B6\u6001\u7801 ${response.status}`);
196
- if (config.deleteAfterVerify) await removeUploadedSourceMaps(artifacts);
237
+ if (deleteAfterVerify) await removeUploadedSourceMaps(artifacts);
197
238
  console.info("Source Map \u5236\u54C1\u6E05\u5355\u4E0E\u670D\u52A1\u7AEF\u4E00\u81F4");
198
239
  }
199
240
  async function doctor(config) {
@@ -208,13 +249,27 @@ async function runFaultLensCli(args, env = process.env) {
208
249
  const subcommand = args[1];
209
250
  const config = resolveCliOptions(args, env);
210
251
  if (command === "doctor") return doctor(config);
211
- if (command !== "sourcemaps" || !["upload", "verify"].includes(subcommand ?? "")) {
212
- throw new Error("\u7528\u6CD5\uFF1Afaultlens sourcemaps <upload|verify> [\u53C2\u6570]\uFF0C\u6216 faultlens doctor [\u53C2\u6570]");
252
+ if (command !== "sourcemaps" || !["upload", "verify", "release"].includes(subcommand ?? "")) {
253
+ throw new Error("\u7528\u6CD5\uFF1Afaultlens sourcemaps <upload|verify|release> [\u53C2\u6570]\uFF0C\u6216 faultlens doctor [\u53C2\u6570]");
213
254
  }
255
+ if (!config.dryRun) required(config.token, "--token \u6216 FAULTLENS_SOURCEMAP_TOKEN");
214
256
  const artifacts = await prepareSourceMapArtifacts(config.root, config.dryRun);
215
257
  if (subcommand === "upload") return upload(config, artifacts);
216
258
  if (config.dryRun) {
217
- console.info(`\u6F14\u7EC3\u5B8C\u6210\uFF1A\u5C06\u6821\u9A8C ${artifacts.length} \u4E2A Source Map \u6587\u4EF6`);
259
+ if (subcommand === "release") {
260
+ await synchronizeCompressedBundles(artifacts, true);
261
+ console.info(`\u6F14\u7EC3\u5B8C\u6210\uFF1A\u5C06\u4E0A\u4F20\u3001\u6821\u9A8C\u5E76\u5220\u9664 ${artifacts.length} \u4E2A Source Map \u6587\u4EF6`);
262
+ } else {
263
+ console.info(`\u6F14\u7EC3\u5B8C\u6210\uFF1A\u5C06\u6821\u9A8C ${artifacts.length} \u4E2A Source Map \u6587\u4EF6`);
264
+ }
265
+ return;
266
+ }
267
+ if (subcommand === "release") {
268
+ await upload(config, artifacts);
269
+ await synchronizeCompressedBundles(artifacts, false);
270
+ await verify(config, artifacts, false);
271
+ await removeUploadedSourceMaps(artifacts);
272
+ console.info("Source Map \u53D1\u5E03\u5B8C\u6210\uFF0C\u672C\u5730\u6620\u5C04\u6587\u4EF6\u5DF2\u5220\u9664");
218
273
  return;
219
274
  }
220
275
  return verify(config, artifacts);
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { createErrorMonitor, installFetchInstrumentation, installXhrInstrumentation } from './chunk-ZEZNKS4A.js';
2
- export { FetchTelemetryTransport, defaultShouldCaptureHttpError, formatTraceParent, parseTraceParent, traceContextHeaders } from './chunk-ZUSG3UKB.js';
1
+ export { createErrorMonitor, installFetchInstrumentation, installXhrInstrumentation } from './chunk-RFH3EN3N.js';
2
+ export { FetchTelemetryTransport, formatTraceParent, parseTraceParent, traceContextHeaders } from './chunk-VTX5KF2X.js';
3
+ export { defaultShouldCaptureHttpError } from './chunk-GKS4FQKU.js';
@@ -1,5 +1,6 @@
1
- import { parseTransportResponse, parseRemoteSdkConfig, parseTelemetryTransportResponse, createMonitorRuntime, captureHttpError, createHttpErrorContext } from '../chunk-ZUSG3UKB.js';
2
- export { defaultShouldCaptureHttpError } from '../chunk-ZUSG3UKB.js';
1
+ import { parseTransportResponse, parseRemoteSdkConfig, parseTelemetryTransportResponse, createMonitorRuntime } from '../chunk-VTX5KF2X.js';
2
+ import { captureHttpError, createHttpErrorContext, isHttpSuccessStatus } from '../chunk-GKS4FQKU.js';
3
+ export { defaultShouldCaptureHttpError } from '../chunk-GKS4FQKU.js';
3
4
  import { createSignedRelayHeaders } from '../chunk-RXQF7F2E.js';
4
5
  import { AsyncLocalStorage } from 'async_hooks';
5
6
  import { createDecipheriv, randomBytes, createCipheriv } from 'crypto';
@@ -333,7 +334,7 @@ function installNodeHttpInstrumentation(monitor, options = {}) {
333
334
  };
334
335
  request.once("response", (response) => {
335
336
  const status = response.statusCode ?? 0;
336
- finishSpan(status === 200 ? "ok" : "error", response);
337
+ finishSpan(isHttpSuccessStatus(status) ? "ok" : "error", response);
337
338
  captureHttpError(
338
339
  monitor,
339
340
  "http.node",
@@ -1,4 +1,5 @@
1
- import { clientRedact, SDK_VERSION, parseErrorStack } from '../../chunk-ZUSG3UKB.js';
1
+ import { clientRedact, SDK_VERSION, parseErrorStack } from '../../chunk-VTX5KF2X.js';
2
+ import '../../chunk-GKS4FQKU.js';
2
3
  import { createSignedRelayHeaders } from '../../chunk-RXQF7F2E.js';
3
4
  import { randomUUID } from 'crypto';
4
5
 
@@ -1,6 +1,7 @@
1
- import { createErrorMonitor } from '../../chunk-ZEZNKS4A.js';
1
+ import { createErrorMonitor } from '../../chunk-RFH3EN3N.js';
2
2
  import { installVueErrorMonitor } from '../../chunk-P6Q63P6L.js';
3
- import '../../chunk-ZUSG3UKB.js';
3
+ import '../../chunk-VTX5KF2X.js';
4
+ import '../../chunk-GKS4FQKU.js';
4
5
  import { defineNuxtPlugin, useRuntimeConfig } from '#app';
5
6
 
6
7
  var plugin_default = defineNuxtPlugin({
@@ -1,5 +1,6 @@
1
- import { createErrorMonitor } from '../chunk-ZEZNKS4A.js';
2
- import '../chunk-ZUSG3UKB.js';
1
+ import { createErrorMonitor } from '../chunk-RFH3EN3N.js';
2
+ import '../chunk-VTX5KF2X.js';
3
+ import '../chunk-GKS4FQKU.js';
3
4
  import { Component, createElement } from 'react';
4
5
 
5
6
  function createReactErrorMonitor(options) {
@@ -1,4 +1,5 @@
1
- import { createMonitorRuntime } from '../chunk-ZUSG3UKB.js';
1
+ import { createMonitorRuntime } from '../chunk-VTX5KF2X.js';
2
+ import '../chunk-GKS4FQKU.js';
2
3
 
3
4
  // src/testing/index.ts
4
5
  var TestTransport = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkitio/faultlens",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "FaultLens 的 Browser、Node、Vue、Nuxt、React 与 Web 框架错误采集 SDK",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -28,6 +28,10 @@
28
28
  "types": "./dist/node/index.d.ts",
29
29
  "import": "./dist/node/index.js"
30
30
  },
31
+ "./axios": {
32
+ "types": "./dist/axios/index.d.ts",
33
+ "import": "./dist/axios/index.js"
34
+ },
31
35
  "./web-vitals": {
32
36
  "types": "./dist/web-vitals/index.d.ts",
33
37
  "import": "./dist/web-vitals/index.js"
@@ -67,6 +71,7 @@
67
71
  "peerDependencies": {
68
72
  "@nuxt/kit": ">=4.1.0 <5",
69
73
  "@nuxt/schema": ">=4.1.0 <5",
74
+ "axios": ">=0.21.1 <2",
70
75
  "express": ">=4.18.0 <6",
71
76
  "fastify": ">=4.0.0 <6",
72
77
  "h3": ">=1.15.0 <2",
@@ -80,6 +85,9 @@
80
85
  "@nuxt/schema": {
81
86
  "optional": true
82
87
  },
88
+ "axios": {
89
+ "optional": true
90
+ },
83
91
  "express": {
84
92
  "optional": true
85
93
  },
@@ -101,6 +109,8 @@
101
109
  "@nuxt/kit": "4.1.0",
102
110
  "@nuxt/schema": "4.1.0",
103
111
  "@types/react": "19.1.11",
112
+ "axios": "1.19.0",
113
+ "axios-legacy": "npm:axios@0.21.4",
104
114
  "h3": "1.15.9",
105
115
  "react": "19.1.1",
106
116
  "tsup": "8.5.0",