@nexload-sdk/healthcheck-bun 2.0.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/README.md +16 -0
- package/dist/index.cjs +115 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +85 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @nexload-sdk/healthcheck-bun
|
|
2
|
+
|
|
3
|
+
Bun runtime adapter and Bun server metrics for `@nexload-sdk/healthcheck`.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createHealthManager, shutdownCheck } from "@nexload-sdk/healthcheck";
|
|
7
|
+
import { bunRuntimeAdapter, bunServerMetricsCheck } from "@nexload-sdk/healthcheck-bun";
|
|
8
|
+
|
|
9
|
+
const server = Bun.serve({ fetch: () => new Response("ok") });
|
|
10
|
+
|
|
11
|
+
export const health = createHealthManager({
|
|
12
|
+
service: { name: "bun-api" },
|
|
13
|
+
runtime: bunRuntimeAdapter(),
|
|
14
|
+
checks: [shutdownCheck(), bunServerMetricsCheck(server)]
|
|
15
|
+
});
|
|
16
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// @nexload-sdk/healthcheck-bun v1.0.0 (build 2026-06-21T16:03:28.597Z)
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
bunRuntimeAdapter: () => bunRuntimeAdapter,
|
|
25
|
+
bunRuntimeInfoCheck: () => bunRuntimeInfoCheck,
|
|
26
|
+
bunServerMetricsCheck: () => bunServerMetricsCheck
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
var import_healthcheck = require("@nexload-sdk/healthcheck");
|
|
30
|
+
function getBun() {
|
|
31
|
+
return globalThis.Bun ?? null;
|
|
32
|
+
}
|
|
33
|
+
function getProcess() {
|
|
34
|
+
return globalThis.process;
|
|
35
|
+
}
|
|
36
|
+
function finitePositive(value) {
|
|
37
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
|
|
38
|
+
}
|
|
39
|
+
function memorySnapshot() {
|
|
40
|
+
var _a;
|
|
41
|
+
const processLike = getProcess();
|
|
42
|
+
const memory = (_a = processLike == null ? void 0 : processLike.memoryUsage) == null ? void 0 : _a.call(processLike);
|
|
43
|
+
return {
|
|
44
|
+
rssBytes: finitePositive(memory == null ? void 0 : memory.rss),
|
|
45
|
+
heapTotalBytes: finitePositive(memory == null ? void 0 : memory.heapTotal),
|
|
46
|
+
heapUsedBytes: finitePositive(memory == null ? void 0 : memory.heapUsed),
|
|
47
|
+
externalBytes: finitePositive(memory == null ? void 0 : memory.external),
|
|
48
|
+
arrayBuffersBytes: finitePositive(memory == null ? void 0 : memory.arrayBuffers),
|
|
49
|
+
constrainedBytes: null,
|
|
50
|
+
availableBytes: null,
|
|
51
|
+
totalBytes: null,
|
|
52
|
+
usedRatio: null,
|
|
53
|
+
availableRatio: null,
|
|
54
|
+
source: memory ? "process" : "none"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function bunRuntimeAdapter() {
|
|
58
|
+
const bun = getBun();
|
|
59
|
+
const processLike = getProcess();
|
|
60
|
+
return {
|
|
61
|
+
name: "bun",
|
|
62
|
+
now: () => performance.now(),
|
|
63
|
+
uptimeSeconds: () => {
|
|
64
|
+
var _a;
|
|
65
|
+
return finitePositive((_a = processLike == null ? void 0 : processLike.uptime) == null ? void 0 : _a.call(processLike)) ?? null;
|
|
66
|
+
},
|
|
67
|
+
getRuntimeInfo: () => ({
|
|
68
|
+
name: "bun",
|
|
69
|
+
version: bun == null ? void 0 : bun.version,
|
|
70
|
+
revision: bun == null ? void 0 : bun.revision,
|
|
71
|
+
platform: processLike == null ? void 0 : processLike.platform,
|
|
72
|
+
arch: processLike == null ? void 0 : processLike.arch,
|
|
73
|
+
pid: processLike == null ? void 0 : processLike.pid
|
|
74
|
+
}),
|
|
75
|
+
getMemory: memorySnapshot
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function bunRuntimeInfoCheck(options = {}) {
|
|
79
|
+
return (0, import_healthcheck.defineHealthCheck)({
|
|
80
|
+
name: "bun.runtime",
|
|
81
|
+
scopes: options.scopes ?? ["diagnostics"],
|
|
82
|
+
critical: false,
|
|
83
|
+
run(ctx) {
|
|
84
|
+
const info = ctx.runtime.getRuntimeInfo();
|
|
85
|
+
return {
|
|
86
|
+
status: info.name === "bun" ? "ok" : "degraded",
|
|
87
|
+
metrics: { uptimeSeconds: ctx.runtime.uptimeSeconds() },
|
|
88
|
+
details: { ...info }
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function bunServerMetricsCheck(server, options = {}) {
|
|
94
|
+
return (0, import_healthcheck.defineHealthCheck)({
|
|
95
|
+
name: "bun.server.metrics",
|
|
96
|
+
scopes: options.scopes ?? ["diagnostics"],
|
|
97
|
+
critical: false,
|
|
98
|
+
run() {
|
|
99
|
+
return {
|
|
100
|
+
status: "ok",
|
|
101
|
+
metrics: {
|
|
102
|
+
pendingRequests: server.pendingRequests ?? null,
|
|
103
|
+
pendingWebSockets: server.pendingWebSockets ?? null
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
bunRuntimeAdapter,
|
|
112
|
+
bunRuntimeInfoCheck,
|
|
113
|
+
bunServerMetricsCheck
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { defineHealthCheck } from \"@nexload-sdk/healthcheck\";\n\nimport type {\n HealthCheckDefinition,\n HealthScope,\n RuntimeAdapter,\n RuntimeMemorySnapshot\n} from \"@nexload-sdk/healthcheck\";\n\ninterface BunGlobalShape {\n version?: string\n revision?: string\n}\n\nexport interface BunServerLike {\n pendingRequests?: number\n pendingWebSockets?: number\n subscriberCount?: (topic: string) => number\n}\n\nfunction getBun (): BunGlobalShape | null {\n return (globalThis as typeof globalThis & { Bun?: BunGlobalShape }).Bun ?? null;\n}\n\nfunction getProcess () {\n return (globalThis as typeof globalThis & { process?: NodeJS.Process }).process;\n}\n\nfunction finitePositive (value: unknown): number | null {\n return typeof value === \"number\" && Number.isFinite(value) && value > 0\n ? value\n : null;\n}\n\nfunction memorySnapshot (): RuntimeMemorySnapshot {\n const processLike = getProcess();\n const memory = processLike?.memoryUsage?.();\n\n return {\n rssBytes: finitePositive(memory?.rss),\n heapTotalBytes: finitePositive(memory?.heapTotal),\n heapUsedBytes: finitePositive(memory?.heapUsed),\n externalBytes: finitePositive(memory?.external),\n arrayBuffersBytes: finitePositive(memory?.arrayBuffers),\n constrainedBytes: null,\n availableBytes: null,\n totalBytes: null,\n usedRatio: null,\n availableRatio: null,\n source: memory ? \"process\" : \"none\",\n };\n}\n\nexport function bunRuntimeAdapter (): RuntimeAdapter {\n const bun = getBun();\n const processLike = getProcess();\n\n return {\n name: \"bun\",\n now: () => performance.now(),\n uptimeSeconds: () => finitePositive(processLike?.uptime?.()) ?? null,\n getRuntimeInfo: () => ({\n name: \"bun\",\n version: bun?.version,\n revision: bun?.revision,\n platform: processLike?.platform,\n arch: processLike?.arch,\n pid: processLike?.pid,\n }),\n getMemory: memorySnapshot,\n };\n}\n\nexport function bunRuntimeInfoCheck (options: { scopes?: readonly HealthScope[] } = {}): HealthCheckDefinition<\"bun.runtime\"> {\n return defineHealthCheck({\n name: \"bun.runtime\",\n scopes: options.scopes ?? [\"diagnostics\"],\n critical: false,\n run (ctx) {\n const info = ctx.runtime.getRuntimeInfo();\n\n return {\n status: info.name === \"bun\" ? \"ok\" : \"degraded\",\n metrics: { uptimeSeconds: ctx.runtime.uptimeSeconds(), },\n details: { ...info, },\n };\n },\n });\n}\n\nexport function bunServerMetricsCheck (\n server: BunServerLike, options: { scopes?: readonly HealthScope[] } = {}\n): HealthCheckDefinition<\"bun.server.metrics\"> {\n return defineHealthCheck({\n name: \"bun.server.metrics\",\n scopes: options.scopes ?? [\"diagnostics\"],\n critical: false,\n run () {\n return {\n status: \"ok\",\n metrics: {\n pendingRequests: server.pendingRequests ?? null,\n pendingWebSockets: server.pendingWebSockets ?? null,\n },\n };\n },\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAoBlC,SAAS,SAAiC;AACxC,SAAQ,WAA4D,OAAO;AAC7E;AAE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AAAA,QACL,QAAQ,KAAK,SAAS,QAAQ,OAAO;AAAA,QACrC,SAAS,EAAE,eAAe,IAAI,QAAQ,cAAc,EAAG;AAAA,QACvD,SAAS,EAAE,GAAG,KAAM;AAAA,MACtB;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,SAAS,sBACd,QAAuB,UAA+C,CAAC,GAC1B;AAC7C,aAAO,sCAAkB;AAAA,IACvB,MAAM;AAAA,IACN,QAAQ,QAAQ,UAAU,CAAC,aAAa;AAAA,IACxC,UAAU;AAAA,IACV,MAAO;AACL,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,iBAAiB,OAAO,mBAAmB;AAAA,UAC3C,mBAAmB,OAAO,qBAAqB;AAAA,QACjD;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HealthCheckDefinition, HealthScope, RuntimeAdapter } from "@nexload-sdk/healthcheck";
|
|
2
|
+
export interface BunServerLike {
|
|
3
|
+
pendingRequests?: number;
|
|
4
|
+
pendingWebSockets?: number;
|
|
5
|
+
subscriberCount?: (topic: string) => number;
|
|
6
|
+
}
|
|
7
|
+
export declare function bunRuntimeAdapter(): RuntimeAdapter;
|
|
8
|
+
export declare function bunRuntimeInfoCheck(options?: {
|
|
9
|
+
scopes?: readonly HealthScope[];
|
|
10
|
+
}): HealthCheckDefinition<"bun.runtime">;
|
|
11
|
+
export declare function bunServerMetricsCheck(server: BunServerLike, options?: {
|
|
12
|
+
scopes?: readonly HealthScope[];
|
|
13
|
+
}): HealthCheckDefinition<"bun.server.metrics">;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAOlC,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CAC5C;AAmCD,wBAAgB,iBAAiB,IAAK,cAAc,CAkBnD;AAED,wBAAgB,mBAAmB,CAAE,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;CAAO,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAe5H;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;CAAO,GACvE,qBAAqB,CAAC,oBAAoB,CAAC,CAe7C"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @nexload-sdk/healthcheck-bun v1.0.0 (build 2026-06-21T16:03:28.434Z)
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { defineHealthCheck } from "@nexload-sdk/healthcheck";
|
|
5
|
+
function getBun() {
|
|
6
|
+
return globalThis.Bun ?? null;
|
|
7
|
+
}
|
|
8
|
+
function getProcess() {
|
|
9
|
+
return globalThis.process;
|
|
10
|
+
}
|
|
11
|
+
function finitePositive(value) {
|
|
12
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
|
|
13
|
+
}
|
|
14
|
+
function memorySnapshot() {
|
|
15
|
+
const processLike = getProcess();
|
|
16
|
+
const memory = processLike?.memoryUsage?.();
|
|
17
|
+
return {
|
|
18
|
+
rssBytes: finitePositive(memory?.rss),
|
|
19
|
+
heapTotalBytes: finitePositive(memory?.heapTotal),
|
|
20
|
+
heapUsedBytes: finitePositive(memory?.heapUsed),
|
|
21
|
+
externalBytes: finitePositive(memory?.external),
|
|
22
|
+
arrayBuffersBytes: finitePositive(memory?.arrayBuffers),
|
|
23
|
+
constrainedBytes: null,
|
|
24
|
+
availableBytes: null,
|
|
25
|
+
totalBytes: null,
|
|
26
|
+
usedRatio: null,
|
|
27
|
+
availableRatio: null,
|
|
28
|
+
source: memory ? "process" : "none"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function bunRuntimeAdapter() {
|
|
32
|
+
const bun = getBun();
|
|
33
|
+
const processLike = getProcess();
|
|
34
|
+
return {
|
|
35
|
+
name: "bun",
|
|
36
|
+
now: () => performance.now(),
|
|
37
|
+
uptimeSeconds: () => finitePositive(processLike?.uptime?.()) ?? null,
|
|
38
|
+
getRuntimeInfo: () => ({
|
|
39
|
+
name: "bun",
|
|
40
|
+
version: bun?.version,
|
|
41
|
+
revision: bun?.revision,
|
|
42
|
+
platform: processLike?.platform,
|
|
43
|
+
arch: processLike?.arch,
|
|
44
|
+
pid: processLike?.pid
|
|
45
|
+
}),
|
|
46
|
+
getMemory: memorySnapshot
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function bunRuntimeInfoCheck(options = {}) {
|
|
50
|
+
return defineHealthCheck({
|
|
51
|
+
name: "bun.runtime",
|
|
52
|
+
scopes: options.scopes ?? ["diagnostics"],
|
|
53
|
+
critical: false,
|
|
54
|
+
run(ctx) {
|
|
55
|
+
const info = ctx.runtime.getRuntimeInfo();
|
|
56
|
+
return {
|
|
57
|
+
status: info.name === "bun" ? "ok" : "degraded",
|
|
58
|
+
metrics: { uptimeSeconds: ctx.runtime.uptimeSeconds() },
|
|
59
|
+
details: { ...info }
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function bunServerMetricsCheck(server, options = {}) {
|
|
65
|
+
return defineHealthCheck({
|
|
66
|
+
name: "bun.server.metrics",
|
|
67
|
+
scopes: options.scopes ?? ["diagnostics"],
|
|
68
|
+
critical: false,
|
|
69
|
+
run() {
|
|
70
|
+
return {
|
|
71
|
+
status: "ok",
|
|
72
|
+
metrics: {
|
|
73
|
+
pendingRequests: server.pendingRequests ?? null,
|
|
74
|
+
pendingWebSockets: server.pendingWebSockets ?? null
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
bunRuntimeAdapter,
|
|
82
|
+
bunRuntimeInfoCheck,
|
|
83
|
+
bunServerMetricsCheck
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { defineHealthCheck } from \"@nexload-sdk/healthcheck\";\n\nimport type {\n HealthCheckDefinition,\n HealthScope,\n RuntimeAdapter,\n RuntimeMemorySnapshot\n} from \"@nexload-sdk/healthcheck\";\n\ninterface BunGlobalShape {\n version?: string\n revision?: string\n}\n\nexport interface BunServerLike {\n pendingRequests?: number\n pendingWebSockets?: number\n subscriberCount?: (topic: string) => number\n}\n\nfunction getBun (): BunGlobalShape | null {\n return (globalThis as typeof globalThis & { Bun?: BunGlobalShape }).Bun ?? null;\n}\n\nfunction getProcess () {\n return (globalThis as typeof globalThis & { process?: NodeJS.Process }).process;\n}\n\nfunction finitePositive (value: unknown): number | null {\n return typeof value === \"number\" && Number.isFinite(value) && value > 0\n ? value\n : null;\n}\n\nfunction memorySnapshot (): RuntimeMemorySnapshot {\n const processLike = getProcess();\n const memory = processLike?.memoryUsage?.();\n\n return {\n rssBytes: finitePositive(memory?.rss),\n heapTotalBytes: finitePositive(memory?.heapTotal),\n heapUsedBytes: finitePositive(memory?.heapUsed),\n externalBytes: finitePositive(memory?.external),\n arrayBuffersBytes: finitePositive(memory?.arrayBuffers),\n constrainedBytes: null,\n availableBytes: null,\n totalBytes: null,\n usedRatio: null,\n availableRatio: null,\n source: memory ? \"process\" : \"none\",\n };\n}\n\nexport function bunRuntimeAdapter (): RuntimeAdapter {\n const bun = getBun();\n const processLike = getProcess();\n\n return {\n name: \"bun\",\n now: () => performance.now(),\n uptimeSeconds: () => finitePositive(processLike?.uptime?.()) ?? null,\n getRuntimeInfo: () => ({\n name: \"bun\",\n version: bun?.version,\n revision: bun?.revision,\n platform: processLike?.platform,\n arch: processLike?.arch,\n pid: processLike?.pid,\n }),\n getMemory: memorySnapshot,\n };\n}\n\nexport function bunRuntimeInfoCheck (options: { scopes?: readonly HealthScope[] } = {}): HealthCheckDefinition<\"bun.runtime\"> {\n return defineHealthCheck({\n name: \"bun.runtime\",\n scopes: options.scopes ?? [\"diagnostics\"],\n critical: false,\n run (ctx) {\n const info = ctx.runtime.getRuntimeInfo();\n\n return {\n status: info.name === \"bun\" ? \"ok\" : \"degraded\",\n metrics: { uptimeSeconds: ctx.runtime.uptimeSeconds(), },\n details: { ...info, },\n };\n },\n });\n}\n\nexport function bunServerMetricsCheck (\n server: BunServerLike, options: { scopes?: readonly HealthScope[] } = {}\n): HealthCheckDefinition<\"bun.server.metrics\"> {\n return defineHealthCheck({\n name: \"bun.server.metrics\",\n scopes: options.scopes ?? [\"diagnostics\"],\n critical: false,\n run () {\n return {\n status: \"ok\",\n metrics: {\n pendingRequests: server.pendingRequests ?? null,\n pendingWebSockets: server.pendingWebSockets ?? null,\n },\n };\n },\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;AAAA,SAAS,yBAAyB;AAoBlC,SAAS,SAAiC;AACxC,SAAQ,WAA4D,OAAO;AAC7E;AAEA,SAAS,aAAc;AACrB,SAAQ,WAAgE;AAC1E;AAEA,SAAS,eAAgB,OAA+B;AACtD,SAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ,IAClE,QACA;AACN;AAEA,SAAS,iBAAyC;AAChD,QAAM,cAAc,WAAW;AAC/B,QAAM,SAAS,aAAa,cAAc;AAE1C,SAAO;AAAA,IACL,UAAU,eA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AAa;AAAA,IACxC,UAAU;AAAA,IACV,MAAO;AACL,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,iBAAiB,OAAO,mBAAmB;AAAA,UAC3C,mBAAmB,OAAO,qBAAqB;AAAA,QACjD;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nexload-sdk/healthcheck-bun",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Bun runtime adapter and Bun server metrics for @nexload-sdk/healthcheck.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"bun",
|
|
7
|
+
"healthcheck",
|
|
8
|
+
"monitoring"
|
|
9
|
+
],
|
|
10
|
+
"author": "GecutWeb",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.cjs",
|
|
21
|
+
"default": "./dist/index.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"package.json"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@nexload-sdk/healthcheck": "4.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^25.0.3",
|
|
38
|
+
"eslint": "^9.39.2",
|
|
39
|
+
"typescript": "5.9.3",
|
|
40
|
+
"@nexload-sdk/eslint-config": "4.0.1",
|
|
41
|
+
"@nexload-sdk/bundler": "4.0.1",
|
|
42
|
+
"@nexload-sdk/typescript-config": "4.0.1"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "node esbuild.config.mjs",
|
|
46
|
+
"lint": "eslint src"
|
|
47
|
+
}
|
|
48
|
+
}
|