@0xchain/telemetry 1.1.0-beta.14 → 1.1.0-beta.16
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/Sampler.d.ts.map +1 -1
- package/dist/ignore-CMi2r3b2.js +114 -0
- package/dist/ignore.d.ts +2 -0
- package/dist/ignore.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -144
- package/dist/middleware.js +1 -1
- package/dist/next.js +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ignore-C99NegwV.js +0 -96
package/dist/Sampler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sampler.d.ts","sourceRoot":"","sources":["../src/Sampler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAIP,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAY,UAAU,EAAoC,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Sampler.d.ts","sourceRoot":"","sources":["../src/Sampler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAIP,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAY,UAAU,EAAoC,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,EAAgB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG5E,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAoCD,iCAAiC;AACjC,eAAO,MAAM,kCAAkC,GAAI,YAAY,UAAU,KAAG,eA4B3E,CAAC;AAcF,iBAAiB;AACjB,eAAO,MAAM,iBAAiB,GAAI,MAAM,YAAY,EAAE,SAAS,eAAe,YAiC7E,CAAC;AAKF,iBAAiB;AACjB,eAAO,MAAM,oBAAoB,GAC/B,OAAO,YAAY,EAAE,GAAG,SAAS,EACjC,SAAS,eAAe,EACxB,cAAc,MAAM,WASrB,CAAC;AAoBF,iBAAiB;AACjB,eAAO,MAAM,sBAAsB,GAAI,SAAS,gBAAgB,KAAG,OAsClE,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,4BAA4B,GAAI,UAAU,YAAY,KAAG,YAAwB,CAAC;AAE/F,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const x = [
|
|
2
|
+
// 健康检查 & 监控
|
|
3
|
+
"/health",
|
|
4
|
+
"/api/health",
|
|
5
|
+
"/metrics",
|
|
6
|
+
"/api/metrics",
|
|
7
|
+
"/readyz",
|
|
8
|
+
"/livez",
|
|
9
|
+
"/monitoring",
|
|
10
|
+
// Next.js 内部路由
|
|
11
|
+
"/_next",
|
|
12
|
+
"/__nextjs_",
|
|
13
|
+
// Next.js App Router 元数据路由
|
|
14
|
+
"/opengraph-image",
|
|
15
|
+
"/twitter-image",
|
|
16
|
+
"/icon",
|
|
17
|
+
"/apple-icon",
|
|
18
|
+
// Vercel 内部路由
|
|
19
|
+
"/_vercel",
|
|
20
|
+
// 静态资源 & SEO
|
|
21
|
+
"/favicon.ico",
|
|
22
|
+
"/robots.txt",
|
|
23
|
+
"/sitemap.xml",
|
|
24
|
+
"/manifest.json",
|
|
25
|
+
"/manifest.webmanifest",
|
|
26
|
+
"/.well-known",
|
|
27
|
+
// 认证回调(NextAuth.js)
|
|
28
|
+
"/api/auth"
|
|
29
|
+
], w = [
|
|
30
|
+
// Next.js 内部服务端操作(非 HTTP 请求,由 Next.js OTel 自动产生)
|
|
31
|
+
/^NextNodeServer\./,
|
|
32
|
+
/^NextServer\./,
|
|
33
|
+
/^BaseServer\./,
|
|
34
|
+
/^AppRender\./,
|
|
35
|
+
/^AppRouteRouteHandlers\./,
|
|
36
|
+
// Next.js 中间件执行 span(如 "middleware GET /path")
|
|
37
|
+
/^middleware /i,
|
|
38
|
+
// Next.js 元数据解析
|
|
39
|
+
/^resolveMetadata$/,
|
|
40
|
+
/^generateMetadata$/
|
|
41
|
+
], f = [
|
|
42
|
+
".css",
|
|
43
|
+
".js",
|
|
44
|
+
".mjs",
|
|
45
|
+
".cjs",
|
|
46
|
+
".png",
|
|
47
|
+
".jpg",
|
|
48
|
+
".jpeg",
|
|
49
|
+
".gif",
|
|
50
|
+
".svg",
|
|
51
|
+
".ico",
|
|
52
|
+
".webp",
|
|
53
|
+
".avif",
|
|
54
|
+
".woff",
|
|
55
|
+
".woff2",
|
|
56
|
+
".ttf",
|
|
57
|
+
".eot",
|
|
58
|
+
".map",
|
|
59
|
+
".txt",
|
|
60
|
+
".xml"
|
|
61
|
+
], h = {
|
|
62
|
+
paths: x,
|
|
63
|
+
extensions: f,
|
|
64
|
+
methods: ["HEAD", "OPTIONS"],
|
|
65
|
+
spanNames: w
|
|
66
|
+
}, C = (e) => e.map((s) => {
|
|
67
|
+
const t = s.trim().toLowerCase();
|
|
68
|
+
return t && (t.startsWith(".") ? t : `.${t}`);
|
|
69
|
+
}), E = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), m = (e, s) => {
|
|
70
|
+
if (e instanceof RegExp)
|
|
71
|
+
return e.test(s);
|
|
72
|
+
const t = e.trim();
|
|
73
|
+
if (!t) return !1;
|
|
74
|
+
if (t.includes("*")) {
|
|
75
|
+
const o = `^${E(t).replace(/\\\*\\\*/g, ".*").replace(/\\\*/g, "[^/]*")}$`;
|
|
76
|
+
return new RegExp(o).test(s);
|
|
77
|
+
}
|
|
78
|
+
return s === t ? !0 : t.endsWith("/") ? s.startsWith(t) : s.startsWith(`${t}/`) || s.startsWith(t);
|
|
79
|
+
}, $ = (e, s) => {
|
|
80
|
+
const t = s.toLowerCase();
|
|
81
|
+
return e.some((n) => n && t.endsWith(n));
|
|
82
|
+
}, j = (e) => {
|
|
83
|
+
var o;
|
|
84
|
+
if (!e) return "default";
|
|
85
|
+
if ((o = e.paths) == null ? void 0 : o.some((a) => a instanceof RegExp)) return null;
|
|
86
|
+
const t = (e.paths ?? []).map(String).sort().join(","), n = (e.extensions ?? []).map((a) => a.toLowerCase()).sort().join(","), p = (e.methods ?? []).map((a) => a.toUpperCase()).sort().join(",");
|
|
87
|
+
return `p:${t}|e:${n}|m:${p}`;
|
|
88
|
+
}, i = /* @__PURE__ */ new Map(), v = 16, N = (e) => {
|
|
89
|
+
var t;
|
|
90
|
+
const s = (t = e == null ? void 0 : e.spanNames) != null && t.length ? e.spanNames : h.spanNames;
|
|
91
|
+
return (n) => !n || !s.length ? !1 : s.some((p) => m(p, n));
|
|
92
|
+
}, R = (e) => {
|
|
93
|
+
var a, l, c;
|
|
94
|
+
const s = j(e);
|
|
95
|
+
if (s) {
|
|
96
|
+
const r = i.get(s);
|
|
97
|
+
if (r) return r;
|
|
98
|
+
}
|
|
99
|
+
const t = (a = e == null ? void 0 : e.paths) != null && a.length ? e.paths : h.paths, n = (l = e == null ? void 0 : e.extensions) != null && l.length ? C(e.extensions) : h.extensions, p = (c = e == null ? void 0 : e.methods) != null && c.length ? e.methods.map((r) => r.toUpperCase()) : h.methods, o = (r, u) => u && p.includes(u.toUpperCase()) ? !0 : r ? $(n, r) ? !0 : t.some((d) => m(d, r)) : !1;
|
|
100
|
+
if (s) {
|
|
101
|
+
if (i.size >= v) {
|
|
102
|
+
const r = i.keys().next().value;
|
|
103
|
+
r && i.delete(r);
|
|
104
|
+
}
|
|
105
|
+
i.set(s, o);
|
|
106
|
+
}
|
|
107
|
+
return o;
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
N as a,
|
|
111
|
+
R as c,
|
|
112
|
+
h as d,
|
|
113
|
+
m
|
|
114
|
+
};
|
package/dist/ignore.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { IgnoreConfig, PathPattern } from './types';
|
|
|
2
2
|
export declare const defaultIgnoreConfig: Required<IgnoreConfig>;
|
|
3
3
|
/** 判断路径是否匹配规则 */
|
|
4
4
|
export declare const matchesPathPattern: (pattern: PathPattern, pathname: string) => boolean;
|
|
5
|
+
/** 创建 span 名称忽略匹配器 */
|
|
6
|
+
export declare const createSpanNameMatcher: (config?: IgnoreConfig) => (spanName: string) => boolean;
|
|
5
7
|
/** 创建忽略规则匹配器(相同配置复用,减少重复创建) */
|
|
6
8
|
export declare const createIgnoreMatcher: (config?: IgnoreConfig) => (pathname: string, method?: string) => boolean;
|
|
7
9
|
//# sourceMappingURL=ignore.d.ts.map
|
package/dist/ignore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAyEzD,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,YAAY,CAKtD,CAAC;AAcF,iBAAiB;AACjB,eAAO,MAAM,kBAAkB,GAAI,SAAS,WAAW,EAAE,UAAU,MAAM,YAmBxE,CAAC;AAsBF,sBAAsB;AACtB,eAAO,MAAM,qBAAqB,GAAI,SAAS,YAAY,MAKjD,UAAU,MAAM,YAIzB,CAAC;AAEF,+BAA+B;AAC/B,eAAO,MAAM,mBAAmB,GAAI,SAAS,YAAY,gBAhBT,MAAM,WAAW,MAAM,KAAK,OAkD3E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildSamplingContextFromAttributes, matchSamplingRule, resolveSamplingRatio } from './Sampler';
|
|
2
|
-
import { createIgnoreMatcher, defaultIgnoreConfig } from './ignore';
|
|
2
|
+
import { createIgnoreMatcher, createSpanNameMatcher, defaultIgnoreConfig } from './ignore';
|
|
3
3
|
import { TelemetryConfig, TelemetryRuntime } from './types';
|
|
4
4
|
export * from './types';
|
|
5
|
-
export { buildSamplingContextFromAttributes, matchSamplingRule, resolveSamplingRatio, createIgnoreMatcher, defaultIgnoreConfig, };
|
|
5
|
+
export { buildSamplingContextFromAttributes, matchSamplingRule, resolveSamplingRatio, createIgnoreMatcher, createSpanNameMatcher, defaultIgnoreConfig, };
|
|
6
6
|
/** 从环境变量加载 Telemetry 配置(异步读取配置文件,不阻塞主线程) */
|
|
7
7
|
export declare const loadTelemetryConfigFromEnv: (env?: NodeJS.ProcessEnv) => Promise<Partial<TelemetryConfig>>;
|
|
8
8
|
/** 合并环境变量与显式配置得到最终配置 */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,kCAAkC,EAGlC,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,kCAAkC,EAGlC,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,KAAK,EAIV,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,CAAC;AA8EF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,GACrC,MAAK,MAAM,CAAC,UAAwB,KACnC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAuClC,CAAC;AAiGF,wBAAwB;AACxB,eAAO,MAAM,sBAAsB,GACjC,UAAS,OAAO,CAAC,eAAe,CAAM,EACtC,MAAK,MAAM,CAAC,UAAwB,KACnC,OAAO,CAAC,eAAe,CAGzB,CAAC;AAEF,oBAAoB;AACpB,eAAO,MAAM,sBAAsB,GACjC,eAAe,OAAO,CAAC,eAAe,CAAC,KACtC,OAAO,CAAC,gBAAgB,CAY1B,CAAC;AAuFF,2BAA2B;AAC3B,eAAO,MAAM,cAAc,GAAU,SAAS,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,8BAgDvF,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,qBAAqB,GAAI,SAAS,OAAO,CAAC,eAAe,CAAC,SAEtE,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,2BAGjE,CAAC;AAEF,gCAAgC;AAChC,eAAO,MAAM,sBAAsB,GAAI,YAAW,OAAO,KAAa,MACtD,OAAO,WAAW,GAAG,GAAG,EAAE,OAAO,WAAW,sBAY3D,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,iBAAiB,qBAI7B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { NodeSDK as b } from "@opentelemetry/sdk-node";
|
|
2
2
|
import { OTLPTraceExporter as v } from "@opentelemetry/exporter-trace-otlp-http";
|
|
3
|
-
import { resourceFromAttributes as
|
|
4
|
-
import { ATTR_SERVICE_VERSION as
|
|
5
|
-
import { SamplingDecision as
|
|
6
|
-
import { trace as
|
|
3
|
+
import { resourceFromAttributes as F } from "@opentelemetry/resources";
|
|
4
|
+
import { ATTR_SERVICE_VERSION as Y, ATTR_SERVICE_NAME as U } from "@opentelemetry/semantic-conventions";
|
|
5
|
+
import { SamplingDecision as d, TraceIdRatioBasedSampler as L, AlwaysOnSampler as G, BatchSpanProcessor as B } from "@opentelemetry/sdk-trace-base";
|
|
6
|
+
import { trace as q, TraceFlags as M, propagation as I, context as V, SpanStatusCode as z } from "@opentelemetry/api";
|
|
7
7
|
import { readFile as k } from "node:fs/promises";
|
|
8
8
|
import { HttpInstrumentation as j } from "@opentelemetry/instrumentation-http";
|
|
9
|
-
import { UndiciInstrumentation as
|
|
10
|
-
import { c as
|
|
11
|
-
const
|
|
9
|
+
import { UndiciInstrumentation as $ } from "@opentelemetry/instrumentation-undici";
|
|
10
|
+
import { c as Q, m as X, a as W, d as J } from "./ignore-CMi2r3b2.js";
|
|
11
|
+
const K = "deployment.environment.name", T = (t, e) => {
|
|
12
12
|
if (!t) return;
|
|
13
13
|
const r = t[e.toLowerCase()];
|
|
14
14
|
if (Array.isArray(r)) {
|
|
@@ -16,55 +16,55 @@ const J = "deployment.environment.name", f = (t, e) => {
|
|
|
16
16
|
return typeof n == "string" ? n : void 0;
|
|
17
17
|
}
|
|
18
18
|
return typeof r == "string" ? r : void 0;
|
|
19
|
-
},
|
|
19
|
+
}, R = (t) => {
|
|
20
20
|
if (!t) return "";
|
|
21
21
|
try {
|
|
22
22
|
return t.startsWith("http://") || t.startsWith("https://") ? new URL(t).pathname : new URL(t, "http://localhost").pathname;
|
|
23
23
|
} catch {
|
|
24
24
|
return t.split("?")[0] || t;
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
function
|
|
28
|
-
const e =
|
|
26
|
+
}, O = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
function Z(t) {
|
|
28
|
+
const e = Q(t.ignore), r = (t.inspectionHeader ?? "x-inspection").toLowerCase(), n = (t.userTypeHeader ?? "x-telemetry-user-type").toLowerCase(), s = (t.requestStartHeader ?? "x-telemetry-start").toLowerCase();
|
|
29
29
|
return [
|
|
30
30
|
new j({
|
|
31
31
|
startIncomingSpanHook: (o) => {
|
|
32
|
-
const
|
|
33
|
-
"telemetry.request.start_time_ms": Number.isFinite(
|
|
32
|
+
const i = "headers" in o ? o.headers : void 0, a = T(i, r), c = T(i, n), p = T(i, s), u = "method" in o ? o.method : void 0, m = R("url" in o ? o.url : void 0), f = Number(p || Date.now()), E = {
|
|
33
|
+
"telemetry.request.start_time_ms": Number.isFinite(f) ? f : Date.now()
|
|
34
34
|
};
|
|
35
|
-
return
|
|
35
|
+
return m && (E["url.path"] = m), u && (E["http.request.method"] = u), a && (E["telemetry.request.inspection"] = !0, E["http.request.header.x-inspection"] = a), c && (E["enduser.type"] = c, E["telemetry.request.user_type"] = c), E;
|
|
36
36
|
},
|
|
37
|
-
requestHook: (o,
|
|
38
|
-
const a = "headers" in
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
37
|
+
requestHook: (o, i) => {
|
|
38
|
+
const a = "headers" in i ? i.headers : void 0, c = T(a, s), p = Number(c || Date.now());
|
|
39
|
+
O.set(o, Number.isFinite(p) ? p : Date.now());
|
|
40
|
+
const u = "method" in i && i.method || "GET", m = R("url" in i ? i.url : void 0);
|
|
41
|
+
m && o.updateName(`${u} ${m}`);
|
|
42
42
|
},
|
|
43
|
-
responseHook: (o,
|
|
44
|
-
const a = "statusCode" in
|
|
43
|
+
responseHook: (o, i) => {
|
|
44
|
+
const a = "statusCode" in i ? i.statusCode : void 0;
|
|
45
45
|
typeof a == "number" && (o.setAttribute("http.response.status_code", a), o.setAttribute("telemetry.response.status_code", a), a >= 500 && o.setAttribute("telemetry.request.error", !0));
|
|
46
|
-
const c =
|
|
46
|
+
const c = O.get(o);
|
|
47
47
|
typeof c == "number" && o.setAttribute("telemetry.request.duration_ms", Date.now() - c);
|
|
48
48
|
},
|
|
49
49
|
ignoreIncomingRequestHook: (o) => {
|
|
50
|
-
const
|
|
50
|
+
const i = "url" in o ? o.url : void 0, a = R(i), c = "method" in o ? o.method : void 0;
|
|
51
51
|
return e(a, c);
|
|
52
52
|
},
|
|
53
53
|
ignoreOutgoingRequestHook: (o) => {
|
|
54
|
-
const
|
|
55
|
-
return e(
|
|
54
|
+
const i = typeof o == "string" ? o : o.path || "";
|
|
55
|
+
return e(R(i));
|
|
56
56
|
}
|
|
57
57
|
}),
|
|
58
|
-
new
|
|
58
|
+
new $()
|
|
59
59
|
];
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const S = (t) => {
|
|
62
62
|
if (typeof t == "string") return t;
|
|
63
63
|
if (Array.isArray(t)) {
|
|
64
64
|
const e = t[0];
|
|
65
65
|
return typeof e == "string" ? e : void 0;
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, P = (t) => {
|
|
68
68
|
if (typeof t == "number") return t;
|
|
69
69
|
if (typeof t == "string") {
|
|
70
70
|
const e = Number(t);
|
|
@@ -72,14 +72,14 @@ const _ = (t) => {
|
|
|
72
72
|
}
|
|
73
73
|
if (Array.isArray(t)) {
|
|
74
74
|
const e = t[0];
|
|
75
|
-
return
|
|
75
|
+
return P(e);
|
|
76
76
|
}
|
|
77
77
|
}, h = (t, e) => {
|
|
78
78
|
for (const r of e)
|
|
79
79
|
if (r in t)
|
|
80
80
|
return t[r];
|
|
81
|
-
},
|
|
82
|
-
const e = h(t, ["url.path", "http.target", "http.route"]), r = h(t, ["http.request.method", "http.method"]), n = h(t, ["enduser.type", "telemetry.request.user_type"]),
|
|
81
|
+
}, tt = (t) => {
|
|
82
|
+
const e = h(t, ["url.path", "http.target", "http.route"]), r = h(t, ["http.request.method", "http.method"]), n = h(t, ["enduser.type", "telemetry.request.user_type"]), s = h(t, [
|
|
83
83
|
"http.response.status_code",
|
|
84
84
|
"http.status_code",
|
|
85
85
|
"telemetry.response.status_code"
|
|
@@ -87,18 +87,18 @@ const _ = (t) => {
|
|
|
87
87
|
"telemetry.request.inspection",
|
|
88
88
|
"http.request.header.x-inspection",
|
|
89
89
|
"x-inspection"
|
|
90
|
-
]),
|
|
90
|
+
]), i = o === !0 || o === "true" || o === "1" || o === 1;
|
|
91
91
|
return {
|
|
92
|
-
path:
|
|
93
|
-
method:
|
|
94
|
-
userType:
|
|
95
|
-
statusCode:
|
|
96
|
-
inspection:
|
|
92
|
+
path: S(e),
|
|
93
|
+
method: S(r),
|
|
94
|
+
userType: S(n),
|
|
95
|
+
statusCode: P(s),
|
|
96
|
+
inspection: i
|
|
97
97
|
};
|
|
98
|
-
},
|
|
98
|
+
}, A = (t, e) => !t || !(e != null && e.length) ? !1 : e.some((r) => r.toLowerCase() === t.toLowerCase()), et = (t, e) => !t || !(e != null && e.length) ? !1 : e.some((r) => X(r, t)), rt = (t, e) => {
|
|
99
99
|
const r = t.when;
|
|
100
100
|
if (!r) return !0;
|
|
101
|
-
if (r.inspection !== void 0 && r.inspection !== e.inspection || r.path && !
|
|
101
|
+
if (r.inspection !== void 0 && r.inspection !== e.inspection || r.path && !et(e.path, r.path) || r.method && !A(e.method, r.method) || r.userType && !A(e.userType, r.userType))
|
|
102
102
|
return !1;
|
|
103
103
|
if (r.statusCode && typeof e.statusCode == "number") {
|
|
104
104
|
if (!r.statusCode.includes(e.statusCode))
|
|
@@ -106,45 +106,51 @@ const _ = (t) => {
|
|
|
106
106
|
} else if (r.statusCode && r.statusCode.length)
|
|
107
107
|
return !1;
|
|
108
108
|
return !(typeof r.minStatusCode == "number" && (typeof e.statusCode != "number" || e.statusCode < r.minStatusCode) || typeof r.maxStatusCode == "number" && (typeof e.statusCode != "number" || e.statusCode > r.maxStatusCode));
|
|
109
|
-
},
|
|
110
|
-
if (!(t != null && t.length)) return
|
|
109
|
+
}, y = (t) => Math.max(0, Math.min(1, t)), nt = (t, e, r) => {
|
|
110
|
+
if (!(t != null && t.length)) return y(r);
|
|
111
111
|
for (const n of t)
|
|
112
|
-
if (
|
|
113
|
-
return
|
|
114
|
-
return
|
|
115
|
-
},
|
|
112
|
+
if (rt(n, e))
|
|
113
|
+
return y(n.ratio);
|
|
114
|
+
return y(r);
|
|
115
|
+
}, w = /* @__PURE__ */ new Map(), ot = (t) => {
|
|
116
116
|
if (t <= 0)
|
|
117
117
|
return new L(0);
|
|
118
118
|
if (t >= 1)
|
|
119
119
|
return new G();
|
|
120
|
-
const e = Number(t.toFixed(6)), r =
|
|
120
|
+
const e = Number(t.toFixed(6)), r = w.get(e);
|
|
121
121
|
if (r) return r;
|
|
122
122
|
const n = new L(e);
|
|
123
|
-
return
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
123
|
+
return w.set(e, n), n;
|
|
124
|
+
}, st = (t) => {
|
|
125
|
+
let e, r;
|
|
126
|
+
return {
|
|
127
|
+
shouldSample(n, s, o, i, a, c) {
|
|
128
|
+
const p = q.getSpanContext(n);
|
|
129
|
+
if (p)
|
|
130
|
+
return (p.traceFlags & M.SAMPLED) === M.SAMPLED ? { decision: d.RECORD_AND_SAMPLED } : { decision: d.NOT_RECORD };
|
|
131
|
+
const u = t.getConfig();
|
|
132
|
+
if (u.ignore !== e && (e = u.ignore, r = W(u.ignore)), r != null && r(o))
|
|
133
|
+
return { decision: d.NOT_RECORD };
|
|
134
|
+
const m = tt(a);
|
|
135
|
+
if (m.inspection)
|
|
136
|
+
return { decision: d.RECORD_AND_SAMPLED };
|
|
137
|
+
const f = nt(
|
|
138
|
+
u.samplingRules,
|
|
139
|
+
m,
|
|
140
|
+
u.defaultSamplingRatio ?? 0.01
|
|
141
|
+
);
|
|
142
|
+
return ot(f).shouldSample(n, s, o, i, a, c);
|
|
143
|
+
},
|
|
144
|
+
toString: () => "RuleBasedSampler"
|
|
145
|
+
};
|
|
146
|
+
}, it = (t) => t;
|
|
147
|
+
let _, l;
|
|
148
|
+
const g = (t) => Array.from(new Set(t)), N = (t) => (t == null ? void 0 : t.split(",").map((e) => e.trim()).filter(Boolean)) ?? [], at = (t) => {
|
|
143
149
|
if (!t) return;
|
|
144
150
|
const e = {};
|
|
145
151
|
for (const r of t.split(",")) {
|
|
146
|
-
const [n, ...
|
|
147
|
-
o && (e[o] =
|
|
152
|
+
const [n, ...s] = r.split("="), o = n == null ? void 0 : n.trim();
|
|
153
|
+
o && (e[o] = s.join("=").trim());
|
|
148
154
|
}
|
|
149
155
|
return e;
|
|
150
156
|
}, C = (t) => {
|
|
@@ -154,7 +160,7 @@ const S = (t) => Array.from(new Set(t)), y = (t) => (t == null ? void 0 : t.spli
|
|
|
154
160
|
} catch {
|
|
155
161
|
return;
|
|
156
162
|
}
|
|
157
|
-
},
|
|
163
|
+
}, ct = async (t) => {
|
|
158
164
|
if (t)
|
|
159
165
|
try {
|
|
160
166
|
const e = await k(t, "utf8");
|
|
@@ -162,52 +168,53 @@ const S = (t) => Array.from(new Set(t)), y = (t) => (t == null ? void 0 : t.spli
|
|
|
162
168
|
} catch {
|
|
163
169
|
return;
|
|
164
170
|
}
|
|
165
|
-
},
|
|
166
|
-
const r =
|
|
171
|
+
}, x = (t, e) => {
|
|
172
|
+
const r = g([...(t == null ? void 0 : t.paths) ?? [], ...(e == null ? void 0 : e.paths) ?? []]), n = g([
|
|
167
173
|
...(t == null ? void 0 : t.extensions) ?? [],
|
|
168
174
|
...(e == null ? void 0 : e.extensions) ?? []
|
|
169
|
-
]),
|
|
175
|
+
]), s = g([...(t == null ? void 0 : t.methods) ?? [], ...(e == null ? void 0 : e.methods) ?? []]), o = g([...(t == null ? void 0 : t.spanNames) ?? [], ...(e == null ? void 0 : e.spanNames) ?? []]);
|
|
170
176
|
return {
|
|
171
177
|
paths: r.length ? r : void 0,
|
|
172
178
|
extensions: n.length ? n : void 0,
|
|
173
|
-
methods:
|
|
179
|
+
methods: s.length ? s : void 0,
|
|
180
|
+
spanNames: o.length ? o : void 0
|
|
174
181
|
};
|
|
175
|
-
},
|
|
182
|
+
}, ut = (t) => {
|
|
176
183
|
if (t != null && t.length)
|
|
177
184
|
return t.map((e) => ({
|
|
178
185
|
...e,
|
|
179
186
|
ratio: Number.isFinite(e.ratio) ? Math.max(0, Math.min(1, e.ratio)) : 0
|
|
180
187
|
})).filter((e) => e.ratio >= 0);
|
|
181
|
-
},
|
|
182
|
-
const e = await
|
|
188
|
+
}, mt = async (t = process.env) => {
|
|
189
|
+
const e = await ct(t.TELEMETRY_CONFIG_FILE), r = N(t.TELEMETRY_IGNORE_PATHS), n = N(t.TELEMETRY_IGNORE_EXTENSIONS), s = N(t.TELEMETRY_IGNORE_METHODS), o = C(t.TELEMETRY_SAMPLING_RULES), i = typeof (e == null ? void 0 : e.samplingRules) == "string" ? C(e.samplingRules) : e == null ? void 0 : e.samplingRules, a = {
|
|
183
190
|
serviceName: t.OTEL_SERVICE_NAME || t.TELEMETRY_SERVICE_NAME,
|
|
184
191
|
serviceVersion: t.OTEL_SERVICE_VERSION || t.TELEMETRY_SERVICE_VERSION,
|
|
185
192
|
environment: t.OTEL_RESOURCE_ATTRIBUTES || t.TELEMETRY_ENVIRONMENT || (t.VERCEL ? t.VERCEL_ENV : void 0),
|
|
186
193
|
defaultSamplingRatio: t.TELEMETRY_SAMPLING_RATIO ? Number(t.TELEMETRY_SAMPLING_RATIO) : void 0,
|
|
187
194
|
url: t.OTEL_EXPORTER_OTLP_ENDPOINT || t.TELEMETRY_OTLP_ENDPOINT,
|
|
188
|
-
headers:
|
|
195
|
+
headers: at(t.OTEL_EXPORTER_OTLP_HEADERS || t.TELEMETRY_OTLP_HEADERS),
|
|
189
196
|
inspectionHeader: t.TELEMETRY_INSPECTION_HEADER,
|
|
190
197
|
userTypeHeader: t.TELEMETRY_USER_TYPE_HEADER,
|
|
191
198
|
requestStartHeader: t.TELEMETRY_REQUEST_START_HEADER,
|
|
192
|
-
samplingRules: o ||
|
|
193
|
-
ignore: r.length || n.length ||
|
|
199
|
+
samplingRules: o || i,
|
|
200
|
+
ignore: r.length || n.length || s.length ? {
|
|
194
201
|
paths: r.length ? r : void 0,
|
|
195
202
|
extensions: n.length ? n : void 0,
|
|
196
|
-
methods:
|
|
203
|
+
methods: s.length ? s : void 0
|
|
197
204
|
} : void 0
|
|
198
205
|
};
|
|
199
206
|
return e && typeof e == "object" ? { ...e, ...a } : a;
|
|
200
|
-
},
|
|
207
|
+
}, pt = (t) => {
|
|
201
208
|
if (!t) return process.env.NODE_ENV || "development";
|
|
202
209
|
if (t.includes("deployment.environment")) {
|
|
203
|
-
const r = t.split(",").find((
|
|
210
|
+
const r = t.split(",").find((s) => s.includes("deployment.environment"));
|
|
204
211
|
if (!r) return t;
|
|
205
212
|
const [, n] = r.split("=");
|
|
206
213
|
return (n == null ? void 0 : n.trim()) || t;
|
|
207
214
|
}
|
|
208
215
|
return t;
|
|
209
|
-
},
|
|
210
|
-
var n,
|
|
216
|
+
}, Et = (t, e) => {
|
|
217
|
+
var n, s;
|
|
211
218
|
const r = [
|
|
212
219
|
{ name: "inspection", ratio: 1, when: { inspection: !0 } },
|
|
213
220
|
{ name: "error", ratio: 1, when: { minStatusCode: 500 } }
|
|
@@ -216,27 +223,27 @@ const S = (t) => Array.from(new Set(t)), y = (t) => (t == null ? void 0 : t.spli
|
|
|
216
223
|
name: "critical-path",
|
|
217
224
|
ratio: 1,
|
|
218
225
|
when: { path: t.criticalPaths }
|
|
219
|
-
}), (
|
|
226
|
+
}), (s = t == null ? void 0 : t.criticalUserTypes) != null && s.length && r.push({
|
|
220
227
|
name: "critical-user",
|
|
221
228
|
ratio: 1,
|
|
222
229
|
when: { userType: t.criticalUserTypes }
|
|
223
230
|
}), t != null && t.pathSampling)
|
|
224
|
-
for (const [o,
|
|
231
|
+
for (const [o, i] of Object.entries(t.pathSampling))
|
|
225
232
|
r.push({
|
|
226
233
|
name: `path:${o}`,
|
|
227
|
-
ratio:
|
|
234
|
+
ratio: i,
|
|
228
235
|
when: { path: [o] }
|
|
229
236
|
});
|
|
230
237
|
if (t != null && t.userTypeSampling)
|
|
231
|
-
for (const [o,
|
|
238
|
+
for (const [o, i] of Object.entries(t.userTypeSampling))
|
|
232
239
|
r.push({
|
|
233
240
|
name: `user:${o}`,
|
|
234
|
-
ratio:
|
|
241
|
+
ratio: i,
|
|
235
242
|
when: { userType: [o] }
|
|
236
243
|
});
|
|
237
244
|
return r.push({ name: "default", ratio: e }), r;
|
|
238
|
-
},
|
|
239
|
-
const e =
|
|
245
|
+
}, H = (t) => {
|
|
246
|
+
const e = pt(t.environment), r = x(J, t.ignore), n = typeof t.defaultSamplingRatio == "number" ? Math.max(0, Math.min(1, t.defaultSamplingRatio)) : 0.01, s = ut(t.samplingRules) ?? Et(t.layeredSampling, n);
|
|
240
247
|
return {
|
|
241
248
|
...t,
|
|
242
249
|
serviceName: t.serviceName || "unknown-service",
|
|
@@ -244,7 +251,7 @@ const S = (t) => Array.from(new Set(t)), y = (t) => (t == null ? void 0 : t.spli
|
|
|
244
251
|
environment: e,
|
|
245
252
|
defaultSamplingRatio: n,
|
|
246
253
|
ignore: r,
|
|
247
|
-
samplingRules:
|
|
254
|
+
samplingRules: s,
|
|
248
255
|
inspectionHeader: t.inspectionHeader ?? "x-inspection",
|
|
249
256
|
userTypeHeader: t.userTypeHeader ?? "x-telemetry-user-type",
|
|
250
257
|
requestStartHeader: t.requestStartHeader ?? "x-telemetry-start",
|
|
@@ -253,105 +260,118 @@ const S = (t) => Array.from(new Set(t)), y = (t) => (t == null ? void 0 : t.spli
|
|
|
253
260
|
maxExportBatchSize: t.maxExportBatchSize ?? 512,
|
|
254
261
|
exporterTimeoutMillis: t.exporterTimeoutMillis ?? 3e4
|
|
255
262
|
};
|
|
256
|
-
},
|
|
257
|
-
const r = await
|
|
258
|
-
return
|
|
259
|
-
},
|
|
260
|
-
let e = await
|
|
263
|
+
}, D = async (t = {}, e = process.env) => {
|
|
264
|
+
const r = await mt(e);
|
|
265
|
+
return H({ ...r, ...t });
|
|
266
|
+
}, lt = async (t) => {
|
|
267
|
+
let e = await D(t);
|
|
261
268
|
return {
|
|
262
269
|
getConfig: () => e,
|
|
263
270
|
updateConfig: (r) => {
|
|
264
|
-
e =
|
|
271
|
+
e = H({
|
|
265
272
|
...e,
|
|
266
273
|
...r,
|
|
267
|
-
ignore:
|
|
274
|
+
ignore: x(e.ignore, r.ignore)
|
|
268
275
|
});
|
|
269
276
|
}
|
|
270
277
|
};
|
|
271
|
-
},
|
|
278
|
+
}, ht = (t) => t[0] * 1e3 + t[1] / 1e6, ft = (t, e) => {
|
|
272
279
|
for (const r of e) {
|
|
273
280
|
const n = t.attributes[r];
|
|
274
281
|
if (typeof n == "number") return n;
|
|
275
282
|
}
|
|
276
|
-
},
|
|
283
|
+
}, dt = (t) => {
|
|
277
284
|
const e = t.events.find((n) => n.name === "exception");
|
|
278
285
|
if (!(e != null && e.attributes)) return;
|
|
279
286
|
const r = e.attributes["exception.message"];
|
|
280
287
|
return typeof r == "string" ? r : void 0;
|
|
281
|
-
},
|
|
288
|
+
}, Tt = /^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)$/, Rt = () => ({
|
|
289
|
+
onStart: (t) => {
|
|
290
|
+
const e = t, r = e.name;
|
|
291
|
+
if (!r || !Tt.test(r)) return;
|
|
292
|
+
const n = e.attributes, s = n["url.path"] ?? n["http.target"] ?? n["http.route"] ?? n["next.route"];
|
|
293
|
+
s && typeof s == "string" && t.updateName(`${r} ${s}`);
|
|
294
|
+
},
|
|
295
|
+
onEnd: () => {
|
|
296
|
+
},
|
|
297
|
+
shutdown: () => Promise.resolve(),
|
|
298
|
+
forceFlush: () => Promise.resolve()
|
|
299
|
+
}), gt = () => ({
|
|
282
300
|
onStart: () => {
|
|
283
301
|
},
|
|
284
302
|
onEnd: (t) => {
|
|
285
|
-
const e =
|
|
303
|
+
const e = ht(t.duration);
|
|
286
304
|
t.attributes["telemetry.request.duration_ms"] = Math.round(e), typeof t.attributes["telemetry.request.start_time_ms"] != "number" && (t.attributes["telemetry.request.start_time_ms"] = Date.now() - Math.round(e));
|
|
287
|
-
const r =
|
|
305
|
+
const r = ft(t, [
|
|
288
306
|
"http.response.status_code",
|
|
289
307
|
"http.status_code",
|
|
290
308
|
"telemetry.response.status_code"
|
|
291
309
|
]);
|
|
292
|
-
if (typeof r == "number" && (t.attributes["telemetry.response.status_code"] = r), t.status.code ===
|
|
310
|
+
if (typeof r == "number" && (t.attributes["telemetry.response.status_code"] = r), t.status.code === z.ERROR || typeof r == "number" && r >= 500) {
|
|
293
311
|
t.attributes["telemetry.request.error"] = !0;
|
|
294
|
-
const
|
|
295
|
-
|
|
312
|
+
const s = t.status.message || dt(t);
|
|
313
|
+
s && (t.attributes["telemetry.request.error_message"] = s);
|
|
296
314
|
}
|
|
297
315
|
},
|
|
298
316
|
shutdown: () => Promise.resolve(),
|
|
299
317
|
forceFlush: () => Promise.resolve()
|
|
300
|
-
}),
|
|
301
|
-
const e = await
|
|
302
|
-
|
|
318
|
+
}), It = async (t) => {
|
|
319
|
+
const e = await D(t);
|
|
320
|
+
l = await lt(e);
|
|
303
321
|
const r = process.env, n = {
|
|
304
322
|
[U]: e.serviceName,
|
|
305
|
-
[
|
|
306
|
-
[
|
|
323
|
+
[Y]: e.serviceVersion || "1.0.0",
|
|
324
|
+
[K]: e.environment || r.VERCEL_ENV || r.NODE_ENV || "development"
|
|
307
325
|
};
|
|
308
326
|
r.VERCEL && (r.VERCEL_REGION && (n["vercel.region"] = r.VERCEL_REGION), r.NEXT_RUNTIME && (n["vercel.runtime"] = r.NEXT_RUNTIME), r.VERCEL_GIT_COMMIT_SHA && (n["vercel.sha"] = r.VERCEL_GIT_COMMIT_SHA), r.VERCEL_URL && (n["vercel.host"] = r.VERCEL_URL), r.VERCEL_BRANCH_URL && (n["vercel.branch_host"] = r.VERCEL_BRANCH_URL), r.VERCEL_DEPLOYMENT_ID && (n["vercel.deployment_id"] = r.VERCEL_DEPLOYMENT_ID));
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
327
|
+
const s = F(n), o = new v(e), i = it(o), a = [
|
|
328
|
+
Rt(),
|
|
329
|
+
gt(),
|
|
330
|
+
new B(i, {
|
|
312
331
|
scheduledDelayMillis: e.scheduledDelayMillis,
|
|
313
332
|
maxQueueSize: e.maxQueueSize,
|
|
314
333
|
maxExportBatchSize: e.maxExportBatchSize,
|
|
315
334
|
exportTimeoutMillis: e.exporterTimeoutMillis
|
|
316
335
|
})
|
|
317
336
|
];
|
|
318
|
-
|
|
337
|
+
_ = new b({
|
|
319
338
|
serviceName: e.serviceName,
|
|
320
|
-
resource:
|
|
339
|
+
resource: s,
|
|
321
340
|
spanProcessors: a,
|
|
322
|
-
sampler:
|
|
323
|
-
instrumentations:
|
|
341
|
+
sampler: st(l),
|
|
342
|
+
instrumentations: Z(e)
|
|
324
343
|
});
|
|
325
344
|
try {
|
|
326
|
-
await
|
|
345
|
+
await _.start();
|
|
327
346
|
} catch (c) {
|
|
328
347
|
console.warn("Telemetry start failed:", c);
|
|
329
348
|
}
|
|
330
|
-
return
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
},
|
|
334
|
-
const n = (r == null ? void 0 : r.headers) ?? (e instanceof Request ? e.headers : void 0),
|
|
335
|
-
return I.inject(V.active(),
|
|
336
|
-
set: (o,
|
|
337
|
-
o.set(
|
|
349
|
+
return l;
|
|
350
|
+
}, Vt = (t) => {
|
|
351
|
+
l == null || l.updateConfig(t);
|
|
352
|
+
}, Pt = (t) => (I.inject(V.active(), t), t), xt = (t = fetch) => async (e, r) => {
|
|
353
|
+
const n = (r == null ? void 0 : r.headers) ?? (e instanceof Request ? e.headers : void 0), s = new Headers(n);
|
|
354
|
+
return I.inject(V.active(), s, {
|
|
355
|
+
set: (o, i, a) => {
|
|
356
|
+
o.set(i, a);
|
|
338
357
|
}
|
|
339
|
-
}), t(e, { ...r, headers:
|
|
340
|
-
},
|
|
341
|
-
|
|
358
|
+
}), t(e, { ...r, headers: s });
|
|
359
|
+
}, Ht = async () => {
|
|
360
|
+
_ && await _.shutdown();
|
|
342
361
|
};
|
|
343
362
|
export {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
rt as
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
363
|
+
tt as buildSamplingContextFromAttributes,
|
|
364
|
+
Q as createIgnoreMatcher,
|
|
365
|
+
xt as createPropagatingFetch,
|
|
366
|
+
W as createSpanNameMatcher,
|
|
367
|
+
lt as createTelemetryRuntime,
|
|
368
|
+
J as defaultIgnoreConfig,
|
|
369
|
+
Pt as injectTraceHeaders,
|
|
370
|
+
mt as loadTelemetryConfigFromEnv,
|
|
371
|
+
rt as matchSamplingRule,
|
|
372
|
+
nt as resolveSamplingRatio,
|
|
373
|
+
D as resolveTelemetryConfig,
|
|
374
|
+
Ht as shutdownTelemetry,
|
|
375
|
+
It as startTelemetry,
|
|
376
|
+
Vt as updateTelemetryConfig
|
|
357
377
|
};
|
package/dist/middleware.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRequest as w, NextResponse as i } from "next/server";
|
|
2
|
-
import { c as g } from "./ignore-
|
|
2
|
+
import { c as g } from "./ignore-CMi2r3b2.js";
|
|
3
3
|
const h = {
|
|
4
4
|
matcher: [
|
|
5
5
|
"/((?!_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml|.*\\.(?:css|js|mjs|cjs|png|jpg|jpeg|gif|svg|ico|webp|avif|woff|woff2|ttf|eot|map|txt|xml)).*)"
|
package/dist/next.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRequest as w, NextResponse as i } from "next/server";
|
|
2
|
-
import { c as g } from "./ignore-
|
|
2
|
+
import { c as g } from "./ignore-CMi2r3b2.js";
|
|
3
3
|
const h = {
|
|
4
4
|
matcher: [
|
|
5
5
|
"/((?!_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml|.*\\.(?:css|js|mjs|cjs|png|jpg|jpeg|gif|svg|ico|webp|avif|woff|woff2|ttf|eot|map|txt|xml)).*)"
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uDAAuD;IACvD,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,eAAgB,SAAQ,0BAA0B;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,aAAa,EAAE,WAAW,KAAK,MAAM,GAAG,SAAS,CAAC;CACtF"}
|
package/package.json
CHANGED
package/dist/ignore-C99NegwV.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
const x = [
|
|
2
|
-
// 健康检查 & 监控
|
|
3
|
-
"/health",
|
|
4
|
-
"/api/health",
|
|
5
|
-
"/metrics",
|
|
6
|
-
"/api/metrics",
|
|
7
|
-
"/readyz",
|
|
8
|
-
"/livez",
|
|
9
|
-
"/monitoring",
|
|
10
|
-
// Next.js 内部路由
|
|
11
|
-
"/_next",
|
|
12
|
-
"/__nextjs_",
|
|
13
|
-
// Next.js App Router 元数据路由
|
|
14
|
-
"/opengraph-image",
|
|
15
|
-
"/twitter-image",
|
|
16
|
-
"/icon",
|
|
17
|
-
"/apple-icon",
|
|
18
|
-
// Vercel 内部路由
|
|
19
|
-
"/_vercel",
|
|
20
|
-
// 静态资源 & SEO
|
|
21
|
-
"/favicon.ico",
|
|
22
|
-
"/robots.txt",
|
|
23
|
-
"/sitemap.xml",
|
|
24
|
-
"/manifest.json",
|
|
25
|
-
"/manifest.webmanifest",
|
|
26
|
-
"/.well-known",
|
|
27
|
-
// 认证回调(NextAuth.js)
|
|
28
|
-
"/api/auth"
|
|
29
|
-
], d = [
|
|
30
|
-
".css",
|
|
31
|
-
".js",
|
|
32
|
-
".mjs",
|
|
33
|
-
".cjs",
|
|
34
|
-
".png",
|
|
35
|
-
".jpg",
|
|
36
|
-
".jpeg",
|
|
37
|
-
".gif",
|
|
38
|
-
".svg",
|
|
39
|
-
".ico",
|
|
40
|
-
".webp",
|
|
41
|
-
".avif",
|
|
42
|
-
".woff",
|
|
43
|
-
".woff2",
|
|
44
|
-
".ttf",
|
|
45
|
-
".eot",
|
|
46
|
-
".map",
|
|
47
|
-
".txt",
|
|
48
|
-
".xml"
|
|
49
|
-
], h = {
|
|
50
|
-
paths: x,
|
|
51
|
-
extensions: d,
|
|
52
|
-
methods: ["HEAD", "OPTIONS"]
|
|
53
|
-
}, f = (e) => e.map((s) => {
|
|
54
|
-
const t = s.trim().toLowerCase();
|
|
55
|
-
return t && (t.startsWith(".") ? t : `.${t}`);
|
|
56
|
-
}), w = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), C = (e, s) => {
|
|
57
|
-
if (e instanceof RegExp)
|
|
58
|
-
return e.test(s);
|
|
59
|
-
const t = e.trim();
|
|
60
|
-
if (!t) return !1;
|
|
61
|
-
if (t.includes("*")) {
|
|
62
|
-
const a = `^${w(t).replace(/\\\*\\\*/g, ".*").replace(/\\\*/g, "[^/]*")}$`;
|
|
63
|
-
return new RegExp(a).test(s);
|
|
64
|
-
}
|
|
65
|
-
return s === t ? !0 : t.endsWith("/") ? s.startsWith(t) : s.startsWith(`${t}/`) || s.startsWith(t);
|
|
66
|
-
}, E = (e, s) => {
|
|
67
|
-
const t = s.toLowerCase();
|
|
68
|
-
return e.some((o) => o && t.endsWith(o));
|
|
69
|
-
}, j = (e) => {
|
|
70
|
-
var a;
|
|
71
|
-
if (!e) return "default";
|
|
72
|
-
if ((a = e.paths) == null ? void 0 : a.some((n) => n instanceof RegExp)) return null;
|
|
73
|
-
const t = (e.paths ?? []).map(String).sort().join(","), o = (e.extensions ?? []).map((n) => n.toLowerCase()).sort().join(","), c = (e.methods ?? []).map((n) => n.toUpperCase()).sort().join(",");
|
|
74
|
-
return `p:${t}|e:${o}|m:${c}`;
|
|
75
|
-
}, i = /* @__PURE__ */ new Map(), g = 16, $ = (e) => {
|
|
76
|
-
var n, p, l;
|
|
77
|
-
const s = j(e);
|
|
78
|
-
if (s) {
|
|
79
|
-
const r = i.get(s);
|
|
80
|
-
if (r) return r;
|
|
81
|
-
}
|
|
82
|
-
const t = (n = e == null ? void 0 : e.paths) != null && n.length ? e.paths : h.paths, o = (p = e == null ? void 0 : e.extensions) != null && p.length ? f(e.extensions) : h.extensions, c = (l = e == null ? void 0 : e.methods) != null && l.length ? e.methods.map((r) => r.toUpperCase()) : h.methods, a = (r, u) => u && c.includes(u.toUpperCase()) ? !0 : r ? E(o, r) ? !0 : t.some((m) => C(m, r)) : !1;
|
|
83
|
-
if (s) {
|
|
84
|
-
if (i.size >= g) {
|
|
85
|
-
const r = i.keys().next().value;
|
|
86
|
-
r && i.delete(r);
|
|
87
|
-
}
|
|
88
|
-
i.set(s, a);
|
|
89
|
-
}
|
|
90
|
-
return a;
|
|
91
|
-
};
|
|
92
|
-
export {
|
|
93
|
-
$ as c,
|
|
94
|
-
h as d,
|
|
95
|
-
C as m
|
|
96
|
-
};
|