srvx 0.1.2 → 0.1.3
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.
|
@@ -20,14 +20,10 @@ declare const NodeRequestProxy: {
|
|
|
20
20
|
referrerPolicy: ReferrerPolicy;
|
|
21
21
|
headers: xHeaders;
|
|
22
22
|
bodyUsed: boolean;
|
|
23
|
-
|
|
24
|
-
req: NodeHttp__default.IncomingMessage;
|
|
25
|
-
res: NodeHttp__default.ServerResponse;
|
|
26
|
-
} | undefined;
|
|
27
|
-
"__#448@#url": URL;
|
|
23
|
+
_url: URL;
|
|
28
24
|
"__#448@#abortSignal"?: AbortController;
|
|
29
25
|
"__#448@#hasBody": boolean | undefined;
|
|
30
|
-
"__#448@#
|
|
26
|
+
"__#448@#bodyBytes"?: Promise<Uint8Array>;
|
|
31
27
|
"__#448@#blobBody"?: Promise<Blob>;
|
|
32
28
|
"__#448@#formDataBody"?: Promise<FormData>;
|
|
33
29
|
"__#448@#jsonBody"?: Promise<any>;
|
|
@@ -40,12 +36,12 @@ declare const NodeRequestProxy: {
|
|
|
40
36
|
readonly signal: AbortSignal;
|
|
41
37
|
readonly _hasBody: boolean;
|
|
42
38
|
readonly body: ReadableStream<Uint8Array<ArrayBufferLike>> | null;
|
|
43
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
44
39
|
bytes(): Promise<Uint8Array>;
|
|
40
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
45
41
|
blob(): Promise<Blob>;
|
|
46
42
|
formData(): Promise<FormData>;
|
|
47
|
-
json(): Promise<any>;
|
|
48
43
|
text(): Promise<string>;
|
|
44
|
+
json(): Promise<any>;
|
|
49
45
|
[kNodeReq]: NodeHttp__default.IncomingMessage;
|
|
50
46
|
readonly [Symbol.toStringTag]: string;
|
|
51
47
|
[kNodeInspect](): {
|
|
@@ -68,7 +64,7 @@ declare const NodeFastResponse: {
|
|
|
68
64
|
status: number;
|
|
69
65
|
statusText: string;
|
|
70
66
|
headers: NodeHttp__default.OutgoingHttpHeader[];
|
|
71
|
-
body: string |
|
|
67
|
+
body: string | Uint8Array<ArrayBufferLike> | ReadableStream<Uint8Array<ArrayBufferLike>> | Buffer<ArrayBufferLike> | DataView<ArrayBufferLike> | null | undefined;
|
|
72
68
|
};
|
|
73
69
|
/** Lazy initialized response instance */
|
|
74
70
|
"__#449@#responseObj"?: Response;
|
|
@@ -20,14 +20,10 @@ declare const NodeRequestProxy: {
|
|
|
20
20
|
referrerPolicy: ReferrerPolicy;
|
|
21
21
|
headers: xHeaders;
|
|
22
22
|
bodyUsed: boolean;
|
|
23
|
-
|
|
24
|
-
req: NodeHttp__default.IncomingMessage;
|
|
25
|
-
res: NodeHttp__default.ServerResponse;
|
|
26
|
-
} | undefined;
|
|
27
|
-
"__#448@#url": URL;
|
|
23
|
+
_url: URL;
|
|
28
24
|
"__#448@#abortSignal"?: AbortController;
|
|
29
25
|
"__#448@#hasBody": boolean | undefined;
|
|
30
|
-
"__#448@#
|
|
26
|
+
"__#448@#bodyBytes"?: Promise<Uint8Array>;
|
|
31
27
|
"__#448@#blobBody"?: Promise<Blob>;
|
|
32
28
|
"__#448@#formDataBody"?: Promise<FormData>;
|
|
33
29
|
"__#448@#jsonBody"?: Promise<any>;
|
|
@@ -40,12 +36,12 @@ declare const NodeRequestProxy: {
|
|
|
40
36
|
readonly signal: AbortSignal;
|
|
41
37
|
readonly _hasBody: boolean;
|
|
42
38
|
readonly body: ReadableStream<Uint8Array<ArrayBufferLike>> | null;
|
|
43
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
44
39
|
bytes(): Promise<Uint8Array>;
|
|
40
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
45
41
|
blob(): Promise<Blob>;
|
|
46
42
|
formData(): Promise<FormData>;
|
|
47
|
-
json(): Promise<any>;
|
|
48
43
|
text(): Promise<string>;
|
|
44
|
+
json(): Promise<any>;
|
|
49
45
|
[kNodeReq]: NodeHttp__default.IncomingMessage;
|
|
50
46
|
readonly [Symbol.toStringTag]: string;
|
|
51
47
|
[kNodeInspect](): {
|
|
@@ -68,7 +64,7 @@ declare const NodeFastResponse: {
|
|
|
68
64
|
status: number;
|
|
69
65
|
statusText: string;
|
|
70
66
|
headers: NodeHttp__default.OutgoingHttpHeader[];
|
|
71
|
-
body: string |
|
|
67
|
+
body: string | Uint8Array<ArrayBufferLike> | ReadableStream<Uint8Array<ArrayBufferLike>> | Buffer<ArrayBufferLike> | DataView<ArrayBufferLike> | null | undefined;
|
|
72
68
|
};
|
|
73
69
|
/** Lazy initialized response instance */
|
|
74
70
|
"__#449@#responseObj"?: Response;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as NodeReqHeadersProxy, N as NodeRequestProxy, b as NodeResHeadersProxy, s as sendNodeResponse } from '../shared/srvx.
|
|
1
|
+
export { a as NodeReqHeadersProxy, N as NodeRequestProxy, b as NodeResHeadersProxy, s as sendNodeResponse } from '../shared/srvx.1e3bbf3a.mjs';
|
|
2
2
|
import { splitSetCookieString } from 'cookie-es';
|
|
3
3
|
|
|
4
4
|
const NodeFastResponse = /* @__PURE__ */ (() => (
|
package/dist/node.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import NodeHttp from 'node:http';
|
|
2
2
|
import { S as Server, r as resolvePort } from './shared/srvx.4f681732.mjs';
|
|
3
|
-
import { N as NodeRequestProxy, s as sendNodeResponse } from './shared/srvx.
|
|
3
|
+
import { N as NodeRequestProxy, s as sendNodeResponse } from './shared/srvx.1e3bbf3a.mjs';
|
|
4
4
|
import 'cookie-es';
|
|
5
5
|
|
|
6
6
|
function serve(options) {
|
|
@@ -337,13 +337,12 @@ const NodeRequestProxy = /* @__PURE__ */ (() => class NodeRequestProxy2 {
|
|
|
337
337
|
this.referrerPolicy = "";
|
|
338
338
|
this.bodyUsed = false;
|
|
339
339
|
this[kNodeReq] = nodeReq;
|
|
340
|
-
this
|
|
340
|
+
this._url = new NodeReqURLProxy(nodeReq);
|
|
341
341
|
this.headers = new NodeReqHeadersProxy(nodeReq);
|
|
342
342
|
}
|
|
343
|
-
#url;
|
|
344
343
|
#abortSignal;
|
|
345
344
|
#hasBody;
|
|
346
|
-
#
|
|
345
|
+
#bodyBytes;
|
|
347
346
|
#blobBody;
|
|
348
347
|
#formDataBody;
|
|
349
348
|
#jsonBody;
|
|
@@ -356,7 +355,7 @@ const NodeRequestProxy = /* @__PURE__ */ (() => class NodeRequestProxy2 {
|
|
|
356
355
|
return new NodeRequestProxy2(this[kNodeReq]);
|
|
357
356
|
}
|
|
358
357
|
get url() {
|
|
359
|
-
return this
|
|
358
|
+
return this._url.href;
|
|
360
359
|
}
|
|
361
360
|
get method() {
|
|
362
361
|
return this[kNodeReq].method || "GET";
|
|
@@ -386,7 +385,7 @@ const NodeRequestProxy = /* @__PURE__ */ (() => class NodeRequestProxy2 {
|
|
|
386
385
|
return true;
|
|
387
386
|
}
|
|
388
387
|
get body() {
|
|
389
|
-
if (!this
|
|
388
|
+
if (!this._hasBody) {
|
|
390
389
|
return null;
|
|
391
390
|
}
|
|
392
391
|
if (!this.#bodyStream) {
|
|
@@ -408,24 +407,25 @@ const NodeRequestProxy = /* @__PURE__ */ (() => class NodeRequestProxy2 {
|
|
|
408
407
|
}
|
|
409
408
|
return this.#bodyStream;
|
|
410
409
|
}
|
|
411
|
-
arrayBuffer() {
|
|
412
|
-
if (!this.#rawBody) {
|
|
413
|
-
const _bodyStream = this.body;
|
|
414
|
-
return _bodyStream ? _readStream(_bodyStream).then((buff) => buff.buffer) : Promise.resolve(new ArrayBuffer(0));
|
|
415
|
-
}
|
|
416
|
-
return this.#rawBody.then((buff) => buff.buffer);
|
|
417
|
-
}
|
|
418
410
|
bytes() {
|
|
419
|
-
if (!this.#
|
|
411
|
+
if (!this.#bodyBytes) {
|
|
420
412
|
const _bodyStream = this.body;
|
|
421
|
-
|
|
413
|
+
this.#bodyBytes = _bodyStream ? _readStream(_bodyStream) : Promise.resolve(new Uint8Array());
|
|
422
414
|
}
|
|
423
|
-
return this.#
|
|
415
|
+
return this.#bodyBytes;
|
|
416
|
+
}
|
|
417
|
+
arrayBuffer() {
|
|
418
|
+
return this.bytes().then((buff) => {
|
|
419
|
+
return buff.buffer.slice(
|
|
420
|
+
buff.byteOffset,
|
|
421
|
+
buff.byteOffset + buff.byteLength
|
|
422
|
+
);
|
|
423
|
+
});
|
|
424
424
|
}
|
|
425
425
|
blob() {
|
|
426
426
|
if (!this.#blobBody) {
|
|
427
|
-
this.#blobBody = this.
|
|
428
|
-
return new Blob([
|
|
427
|
+
this.#blobBody = this.bytes().then((bytes) => {
|
|
428
|
+
return new Blob([bytes], {
|
|
429
429
|
type: this[kNodeReq].headers["content-type"]
|
|
430
430
|
});
|
|
431
431
|
});
|
|
@@ -440,6 +440,14 @@ const NodeRequestProxy = /* @__PURE__ */ (() => class NodeRequestProxy2 {
|
|
|
440
440
|
}
|
|
441
441
|
return this.#formDataBody;
|
|
442
442
|
}
|
|
443
|
+
text() {
|
|
444
|
+
if (!this.#textBody) {
|
|
445
|
+
this.#textBody = this.bytes().then((bytes) => {
|
|
446
|
+
return new TextDecoder().decode(bytes);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return this.#textBody;
|
|
450
|
+
}
|
|
443
451
|
json() {
|
|
444
452
|
if (!this.#jsonBody) {
|
|
445
453
|
this.#jsonBody = this.text().then((txt) => {
|
|
@@ -448,14 +456,6 @@ const NodeRequestProxy = /* @__PURE__ */ (() => class NodeRequestProxy2 {
|
|
|
448
456
|
}
|
|
449
457
|
return this.#jsonBody;
|
|
450
458
|
}
|
|
451
|
-
text() {
|
|
452
|
-
if (!this.#textBody) {
|
|
453
|
-
this.#textBody = this.arrayBuffer().then((buff) => {
|
|
454
|
-
return new TextDecoder().decode(buff);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
return this.#textBody;
|
|
458
|
-
}
|
|
459
459
|
get [(Symbol.toStringTag)]() {
|
|
460
460
|
return "Request";
|
|
461
461
|
}
|