@hyperttp/transport-bun 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IT IF OR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,235 @@
1
+ # BunTransport
2
+
3
+ `BunTransport` is a network transport implementation for `HyperTransport`, designed to run in the **Bun runtime**.
4
+
5
+ It wraps `fetch` and adds:
6
+
7
+ - concurrency limiting
8
+ - request timeouts via `AbortSignal`
9
+ - automatic cookie handling
10
+ - header normalization
11
+ - `keepalive` support
12
+ - access to Bun `tls` options
13
+
14
+ ---
15
+
16
+ ## Interface
17
+
18
+ ```ts
19
+ /**
20
+ * @ru Общий интерфейс для реализации сетевых транспортов.
21
+ * @en Unified interface for building runtime-specific network transports.
22
+ */
23
+ export interface HyperTransport {
24
+ execute(req: TransportRequest): Promise<TransportResponse>;
25
+ close?(): Promise<void>;
26
+ destroy?(): Promise<void>;
27
+ }
28
+ ```
29
+
30
+ `BunTransport` implements this interface and can be used as a runtime-specific HTTP transport in client libraries.
31
+
32
+ ---
33
+
34
+ ## Features
35
+
36
+ - `fetch`-based implementation with `signal` support
37
+ - `redirect: "manual"`
38
+ - automatic merging of cookies from responses and subsequent requests
39
+ - cookie cache per domain
40
+ - request concurrency limiting
41
+ - request timeout support
42
+ - automatic `User-Agent` injection from config (if not provided manually)
43
+ - compatibility with `TransportRequest` / `TransportResponse`
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ `BunTransport` is designed for Bun, so the project must run in the Bun runtime.
50
+
51
+ ```bash
52
+ bun install
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Usage
58
+
59
+ ```ts
60
+ import { BunTransport } from "./BunTransport";
61
+
62
+ const transport = new BunTransport({
63
+ network: {
64
+ timeout: 10_000,
65
+ maxConcurrent: 32,
66
+ userAgent: "Hyperttp/1.0",
67
+ keepAliveTimeout: 30_000,
68
+ rejectUnauthorized: true,
69
+ },
70
+ });
71
+
72
+ const response = await transport.execute({
73
+ url: "https://example.com",
74
+ method: "GET",
75
+ headers: {},
76
+ body: null,
77
+ });
78
+
79
+ console.log(response.status);
80
+ console.log(await response.text());
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Configuration
86
+
87
+ `BunTransport` reads configuration from `HttpClientOptions.network`.
88
+
89
+ Supported options:
90
+
91
+ ```ts
92
+ network?: {
93
+ maxConcurrent?: number;
94
+ timeout?: number;
95
+ userAgent?: string;
96
+ keepAliveTimeout?: number;
97
+ rejectUnauthorized?: boolean;
98
+ }
99
+ ```
100
+
101
+ ### Option behavior
102
+
103
+ - `maxConcurrent` — maximum number of concurrent active requests.
104
+ - `timeout` — global request timeout in milliseconds.
105
+ - `userAgent` — injected into `User-Agent` header if not explicitly set.
106
+ - `keepAliveTimeout` — enables `keepalive` mode when provided.
107
+ - `rejectUnauthorized` — passed to Bun `fetch` via `tls` configuration.
108
+
109
+ ---
110
+
111
+ ## Cookies
112
+
113
+ The transport supports persistent cookie storage and reuse between requests.
114
+
115
+ ### How it works
116
+
117
+ 1. When the server returns `Set-Cookie`, cookies are stored per domain.
118
+ 2. On subsequent requests to the same domain, cookies are automatically attached to the `Cookie` header.
119
+ 3. If the user provides their own `Cookie` header, it is merged with stored cookies.
120
+
121
+ ### Example
122
+
123
+ ```ts
124
+ await transport.execute({
125
+ url: "https://example.com/login",
126
+ method: "POST",
127
+ headers: {
128
+ "Content-Type": "application/json",
129
+ },
130
+ body: JSON.stringify({ login: "demo", password: "secret" }),
131
+ });
132
+
133
+ const res = await transport.execute({
134
+ url: "https://example.com/profile",
135
+ method: "GET",
136
+ headers: {},
137
+ body: null,
138
+ });
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Concurrency limiting
144
+
145
+ If `maxConcurrent > 0`, incoming requests are queued until a slot becomes available.
146
+
147
+ This is useful for:
148
+
149
+ - preventing server overload
150
+ - limiting runtime resource usage
151
+ - avoiding traffic spikes
152
+
153
+ ---
154
+
155
+ ## Timeout & cancellation
156
+
157
+ The transport uses `AbortSignal`:
158
+
159
+ - if `req.signal` is provided, it is respected
160
+ - if `timeout` is set, `AbortSignal.timeout(...)` is created
161
+ - if both exist, they are combined using `AbortSignal.any(...)`
162
+
163
+ If a request is aborted, the signal reason (or a default `AbortError`) is thrown.
164
+
165
+ ---
166
+
167
+ ## Response API
168
+
169
+ `BunTransportResponse` wraps the native `Response` and provides:
170
+
171
+ - `status`
172
+ - `url`
173
+ - `body`
174
+ - `text()`
175
+ - `json()`
176
+ - `headers`
177
+
178
+ ### Body behavior
179
+
180
+ If `body` exists, a `dump()` method may be attached to it, allowing safe stream consumption and resource cleanup.
181
+
182
+ ---
183
+
184
+ ## Internal utilities
185
+
186
+ ### `fastGetHostname(url: string): string`
187
+
188
+ Fast hostname extraction from a URL without full parsing.
189
+
190
+ ### `normalizeHeaderValue(name, value)`
191
+
192
+ Normalizes header values:
193
+
194
+ - `Cookie` headers are joined using `;`
195
+ - other arrays are joined using `,`
196
+
197
+ ### `normalizeCookieHeader(value)`
198
+
199
+ Converts cookie header values into a normalized string.
200
+
201
+ ### `throwIfAborted(signal)`
202
+
203
+ Checks whether an operation has been aborted and throws if so.
204
+
205
+ ---
206
+
207
+ ## Shutdown
208
+
209
+ `BunTransport` supports resource cleanup:
210
+
211
+ ```ts
212
+ await transport.close();
213
+ await transport.destroy();
214
+ ```
215
+
216
+ Both methods clear:
217
+
218
+ - pending request queue
219
+ - cookie jar
220
+ - cookie cache
221
+
222
+ ---
223
+
224
+ ## Notes
225
+
226
+ - Designed specifically for the **Bun runtime**, not Node.js.
227
+ - Uses `redirect: "manual"` for fetch requests.
228
+ - Minimal interference with request data; only headers, cookies, and signals are normalized or extended.
229
+ - `TransportRequest.body` is treated as `BodyInit | null`.
230
+
231
+ ---
232
+
233
+ ## License
234
+
235
+ MIT
package/bun.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import type { HttpClientOptions, HyperTransport, TransportRequest, TransportResponse } from "@hyperttp/types";
2
+ export declare function fastGetHostname(url: string): string;
3
+ export declare function fastStreamDump(this: ReadableStream<Uint8Array>): Promise<void>;
4
+ export declare function getAbortError(signal?: AbortSignal): unknown;
5
+ export declare function throwIfAborted(signal?: AbortSignal): void;
6
+ export declare function normalizeCookieHeader(value: string | string[] | undefined): string;
7
+ export declare function normalizeHeaderValue(name: string, value: string | string[]): string;
8
+ export declare class BunTransport implements HyperTransport {
9
+ config: HttpClientOptions;
10
+ private cookieJar;
11
+ private cookieCache;
12
+ private activeRequests;
13
+ private concurrencyQueue;
14
+ private hasCookies;
15
+ private _maxConcurrent;
16
+ private _timeout;
17
+ private _userAgent;
18
+ private _keepalive;
19
+ private _tlsConfig;
20
+ constructor(config: HttpClientOptions);
21
+ private invalidateConfig;
22
+ execute(req: TransportRequest): Promise<TransportResponse>;
23
+ private prepareHeaders;
24
+ private getCookiesForDomain;
25
+ private updateCookies;
26
+ close(): Promise<void>;
27
+ destroy(): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=bun.d.ts.map
package/bun.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../src/bun.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,iBAAiB,CAAC;AAGzB,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqBnD;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,iBAOpE;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAK3D;AAED,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAWzD;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GACnC,MAAM,CAGR;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GACvB,MAAM,CAYR;AAkDD,qBAAa,YAAa,YAAW,cAAc;IAC1C,MAAM,EAAE,iBAAiB,CAAC;IAEjC,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,WAAW,CAA6B;IAEhD,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAmC;gBAEzC,MAAM,EAAE,iBAAiB;IAKrC,OAAO,CAAC,gBAAgB;IASX,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6DvE,OAAO,CAAC,cAAc;IA0CtB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,aAAa;IAuDR,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtC"}
package/bun.js ADDED
@@ -0,0 +1,286 @@
1
+ export function fastGetHostname(url) {
2
+ if (!url)
3
+ return "localhost";
4
+ if (url.charCodeAt(0) === 47)
5
+ return "localhost";
6
+ let start = url.indexOf("//");
7
+ if (start === -1) {
8
+ start = 0;
9
+ }
10
+ else {
11
+ start += 2;
12
+ }
13
+ let end = url.indexOf("/", start);
14
+ if (end === -1)
15
+ end = url.indexOf("?", start);
16
+ if (end === -1)
17
+ end = url.length;
18
+ const portIdx = url.indexOf(":", start);
19
+ if (portIdx !== -1 && portIdx < end) {
20
+ end = portIdx;
21
+ }
22
+ return url.slice(start, end) || "localhost";
23
+ }
24
+ export async function fastStreamDump() {
25
+ if (this.locked)
26
+ return;
27
+ try {
28
+ await new Response(this).arrayBuffer();
29
+ }
30
+ catch {
31
+ //
32
+ }
33
+ }
34
+ export function getAbortError(signal) {
35
+ return (signal?.reason ??
36
+ new DOMException("The operation was aborted.", "AbortError"));
37
+ }
38
+ export function throwIfAborted(signal) {
39
+ if (!signal)
40
+ return;
41
+ if (typeof signal.throwIfAborted === "function") {
42
+ signal.throwIfAborted();
43
+ return;
44
+ }
45
+ if (signal.aborted) {
46
+ throw getAbortError(signal);
47
+ }
48
+ }
49
+ export function normalizeCookieHeader(value) {
50
+ if (value === undefined)
51
+ return "";
52
+ return Array.isArray(value) ? value.join("; ") : String(value).trim();
53
+ }
54
+ export function normalizeHeaderValue(name, value) {
55
+ if (Array.isArray(value)) {
56
+ const lower = name.toLowerCase();
57
+ if (lower === "cookie") {
58
+ return value.join("; ");
59
+ }
60
+ return value.join(", ");
61
+ }
62
+ return value;
63
+ }
64
+ class BunTransportResponse {
65
+ _nativeResponse;
66
+ _cachedText = null;
67
+ _cachedJson = null;
68
+ _cachedHeaders = null;
69
+ constructor(nativeResponse) {
70
+ this._nativeResponse = nativeResponse;
71
+ }
72
+ get status() {
73
+ return this._nativeResponse.status;
74
+ }
75
+ get url() {
76
+ return this._nativeResponse.url;
77
+ }
78
+ get body() {
79
+ const body = this._nativeResponse.body;
80
+ if (body && body.dump === undefined) {
81
+ body.dump = fastStreamDump;
82
+ }
83
+ return body;
84
+ }
85
+ async text() {
86
+ if (this._cachedText !== null)
87
+ return this._cachedText;
88
+ this._cachedText = await this._nativeResponse.text();
89
+ return this._cachedText;
90
+ }
91
+ async json() {
92
+ return (this._cachedJson ?? (this._cachedJson = await this._nativeResponse.json()));
93
+ }
94
+ get headers() {
95
+ if (this._cachedHeaders === null) {
96
+ const rawHeaders = this._nativeResponse.headers;
97
+ this._cachedHeaders =
98
+ rawHeaders.toJSON?.() || Object.fromEntries(rawHeaders.entries());
99
+ }
100
+ return this._cachedHeaders;
101
+ }
102
+ }
103
+ export class BunTransport {
104
+ config;
105
+ cookieJar = new Map();
106
+ cookieCache = new Map();
107
+ activeRequests = 0;
108
+ concurrencyQueue = [];
109
+ hasCookies = false;
110
+ _maxConcurrent = 0;
111
+ _timeout = 0;
112
+ _userAgent = undefined;
113
+ _keepalive = false;
114
+ _tlsConfig;
115
+ constructor(config) {
116
+ this.config = config;
117
+ this.invalidateConfig();
118
+ }
119
+ invalidateConfig() {
120
+ const net = this.config.network;
121
+ this._maxConcurrent = net?.maxConcurrent ?? 0;
122
+ this._timeout = net?.timeout ?? 0;
123
+ this._userAgent = net?.userAgent;
124
+ this._keepalive = !!net?.keepAliveTimeout;
125
+ this._tlsConfig = { rejectUnauthorized: net?.rejectUnauthorized ?? true };
126
+ }
127
+ async execute(req) {
128
+ const maxConcurrent = this._maxConcurrent;
129
+ let signal = req.signal;
130
+ const timeoutMs = this._timeout;
131
+ if (timeoutMs > 0) {
132
+ const timeoutSignal = AbortSignal.timeout(timeoutMs);
133
+ signal = req.signal
134
+ ? AbortSignal.any([req.signal, timeoutSignal])
135
+ : timeoutSignal;
136
+ }
137
+ throwIfAborted(signal);
138
+ if (maxConcurrent > 0 && this.activeRequests >= maxConcurrent) {
139
+ await new Promise((resolve, reject) => {
140
+ const onAbort = () => {
141
+ signal?.removeEventListener("abort", onAbort);
142
+ reject(getAbortError(signal));
143
+ };
144
+ signal?.addEventListener("abort", onAbort, { once: true });
145
+ this.concurrencyQueue.push(() => {
146
+ signal?.removeEventListener("abort", onAbort);
147
+ resolve();
148
+ });
149
+ });
150
+ }
151
+ throwIfAborted(signal);
152
+ this.activeRequests++;
153
+ try {
154
+ const response = await fetch(req.url, {
155
+ method: req.method,
156
+ headers: this.prepareHeaders(req),
157
+ body: req.body,
158
+ signal,
159
+ keepalive: this._keepalive,
160
+ redirect: "manual",
161
+ tls: this._tlsConfig,
162
+ });
163
+ if (response.headers.has("set-cookie")) {
164
+ const setCookies = response.headers.getSetCookie();
165
+ if (setCookies?.length) {
166
+ this.updateCookies(fastGetHostname(req.url), setCookies);
167
+ }
168
+ }
169
+ return new BunTransportResponse(response);
170
+ }
171
+ finally {
172
+ this.activeRequests--;
173
+ if (maxConcurrent > 0) {
174
+ const nextResolver = this.concurrencyQueue.shift();
175
+ if (nextResolver)
176
+ nextResolver();
177
+ }
178
+ }
179
+ }
180
+ prepareHeaders(req) {
181
+ const original = req.headers;
182
+ const headers = Object.fromEntries(Object.entries(original).map(([key, value]) => [
183
+ key,
184
+ normalizeHeaderValue(key, value),
185
+ ]));
186
+ const ua = this._userAgent;
187
+ if (ua && !headers["User-Agent"] && !headers["user-agent"]) {
188
+ headers["User-Agent"] = ua;
189
+ }
190
+ const userCookie = normalizeCookieHeader(headers["Cookie"]);
191
+ const hasUserCookie = userCookie.length > 0;
192
+ if (!this.hasCookies) {
193
+ if (hasUserCookie) {
194
+ headers["Cookie"] = userCookie;
195
+ }
196
+ return headers;
197
+ }
198
+ const domain = fastGetHostname(req.url);
199
+ const savedCookies = this.getCookiesForDomain(domain);
200
+ const hasSavedCookies = savedCookies.length > 0;
201
+ const cookieParts = [];
202
+ if (hasUserCookie)
203
+ cookieParts.push(userCookie);
204
+ if (hasSavedCookies)
205
+ cookieParts.push(savedCookies);
206
+ if (cookieParts.length > 0) {
207
+ headers["Cookie"] = cookieParts.join("; ");
208
+ }
209
+ return headers;
210
+ }
211
+ getCookiesForDomain(requestDomain) {
212
+ if (this.cookieCache.has(requestDomain)) {
213
+ return this.cookieCache.get(requestDomain);
214
+ }
215
+ const matchedCookies = [];
216
+ for (const [storedDomain, cookiesMap] of this.cookieJar) {
217
+ if (requestDomain === storedDomain ||
218
+ requestDomain.endsWith("." + storedDomain)) {
219
+ for (const [key, val] of cookiesMap) {
220
+ matchedCookies.push(`${key}=${val}`);
221
+ }
222
+ }
223
+ }
224
+ const result = matchedCookies.length > 0 ? matchedCookies.join("; ") : "";
225
+ this.cookieCache.set(requestDomain, result);
226
+ return result;
227
+ }
228
+ updateCookies(requestDomain, setCookies) {
229
+ this.hasCookies = true;
230
+ for (let i = 0; i < setCookies.length; i++) {
231
+ const cookieStr = setCookies[i];
232
+ if (!cookieStr)
233
+ continue;
234
+ const parts = cookieStr.split(";");
235
+ const rawPair = parts[0];
236
+ if (!rawPair)
237
+ continue;
238
+ const equalIdx = rawPair.indexOf("=");
239
+ if (equalIdx === -1)
240
+ continue;
241
+ const key = rawPair.slice(0, equalIdx).trim();
242
+ const val = rawPair.slice(equalIdx + 1).trim();
243
+ if (!key)
244
+ continue;
245
+ let targetDomain = requestDomain;
246
+ for (let j = 1; j < parts.length; j++) {
247
+ const attr = parts[j];
248
+ if (!attr)
249
+ continue;
250
+ const trimmedAttr = attr.trim();
251
+ if (trimmedAttr.toLowerCase().startsWith("domain=")) {
252
+ let domVal = trimmedAttr.slice(7).trim();
253
+ if (domVal.startsWith(".")) {
254
+ domVal = domVal.slice(1);
255
+ }
256
+ if (domVal)
257
+ targetDomain = domVal;
258
+ break;
259
+ }
260
+ }
261
+ let domainMap = this.cookieJar.get(targetDomain);
262
+ if (!domainMap) {
263
+ domainMap = new Map();
264
+ this.cookieJar.set(targetDomain, domainMap);
265
+ }
266
+ domainMap.set(key, val);
267
+ if (this.cookieCache.size > 0) {
268
+ for (const cachedDomain of this.cookieCache.keys()) {
269
+ if (cachedDomain === targetDomain ||
270
+ cachedDomain.endsWith("." + targetDomain)) {
271
+ this.cookieCache.delete(cachedDomain);
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+ async close() {
278
+ this.concurrencyQueue = [];
279
+ this.cookieJar.clear();
280
+ this.cookieCache.clear();
281
+ }
282
+ async destroy() {
283
+ await this.close();
284
+ }
285
+ }
286
+ //# sourceMappingURL=bun.js.map
package/bun.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun.js","sourceRoot":"","sources":["../src/bun.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,IAAI,CAAC,GAAG;QAAE,OAAO,WAAW,CAAC;IAC7B,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE;QAAE,OAAO,WAAW,CAAC;IAEjD,IAAI,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,KAAK,GAAG,CAAC,CAAC;IACZ,CAAC;SAAM,CAAC;QACN,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,IAAI,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9C,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IAEjC,MAAM,O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AG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;YAC9C,CAAC;YAED,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAExB,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC9B,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;oBACnD,IACE,YAAY,KAAK,YAAY;wBAC7B,YAAY,CAAC,QAAQ,CAAC,GAAG,GAAG,YAAY,CAAC,EACzC,CAAC;wBACD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { fastGetHostname, BunTransport } from "./bun.js";
2
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { fastGetHostname, BunTransport } from "./bun.js";
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@hyperttp/transport-bun",
3
+ "version": "0.1.0",
4
+ "description": "High-performance, extensible HTTP client for Bun",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./index.d.ts",
9
+ "import": "./index.js"
10
+ }
11
+ },
12
+ "keywords": [
13
+ "http",
14
+ "client",
15
+ "high-performance",
16
+ "fetch",
17
+ "bun"
18
+ ],
19
+ "author": "dirold2",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/IT-IF-OR/hyperttp-transport-bun.git"
24
+ },
25
+ "peerDependencies": {
26
+ "typescript": "^6",
27
+ "@hyperttp/types": "^0.1.1"
28
+ },
29
+ "peerDependenciesMeta": {
30
+ "typescript": {
31
+ "optional": true
32
+ }
33
+ },
34
+ "private": false
35
+ }