@comapeo/map-server 1.0.0-pre.0 → 1.0.0-pre.2
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/context.d.ts +1 -1
- package/dist/context.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/map-share.js +1 -1
- package/dist/routes/maps.js +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.js +2 -2
- package/node_modules/@fastify/busboy/LICENSE +24 -0
- package/node_modules/@fastify/busboy/README.md +270 -0
- package/node_modules/@fastify/busboy/deps/dicer/LICENSE +19 -0
- package/node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js +213 -0
- package/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js +100 -0
- package/node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js +13 -0
- package/node_modules/@fastify/busboy/deps/dicer/lib/dicer.d.ts +164 -0
- package/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js +230 -0
- package/node_modules/@fastify/busboy/lib/main.d.ts +196 -0
- package/node_modules/@fastify/busboy/lib/main.js +85 -0
- package/node_modules/@fastify/busboy/lib/types/multipart.js +306 -0
- package/node_modules/@fastify/busboy/lib/types/urlencoded.js +190 -0
- package/node_modules/@fastify/busboy/lib/utils/Decoder.js +54 -0
- package/node_modules/@fastify/busboy/lib/utils/basename.js +14 -0
- package/node_modules/@fastify/busboy/lib/utils/decodeText.js +114 -0
- package/node_modules/@fastify/busboy/lib/utils/getLimit.js +16 -0
- package/node_modules/@fastify/busboy/lib/utils/parseParams.js +201 -0
- package/node_modules/@fastify/busboy/package.json +81 -0
- package/node_modules/@whatwg-node/fetch/CHANGELOG.md +941 -0
- package/node_modules/@whatwg-node/fetch/README.md +141 -0
- package/node_modules/@whatwg-node/fetch/dist/create-node-ponyfill.js +100 -0
- package/node_modules/@whatwg-node/fetch/dist/esm-ponyfill.js +71 -0
- package/node_modules/@whatwg-node/fetch/dist/global-ponyfill.js +22 -0
- package/node_modules/@whatwg-node/fetch/dist/index.d.ts +73 -0
- package/node_modules/@whatwg-node/fetch/dist/node-ponyfill.js +35 -0
- package/node_modules/@whatwg-node/fetch/dist/shouldSkipPonyfill.js +17 -0
- package/node_modules/@whatwg-node/fetch/package.json +31 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/AbortError.js +19 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/Blob.js +291 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/Body.js +529 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/CompressionStream.js +34 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/DecompressionStream.js +34 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/File.js +15 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/FormData.js +150 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/Headers.js +309 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/IteratorObject.js +134 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/ReadableStream.js +245 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/Request.js +128 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/Response.js +108 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/TextEncoderDecoder.js +49 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/TextEncoderDecoderStream.js +40 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/TransformStream.js +79 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/URL.js +28 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/URLSearchParams.js +4 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/WritableStream.js +115 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/fetch.js +107 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/fetchCurl.js +142 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/fetchNodeHttp.js +152 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/index.js +42 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/package.json +1 -0
- package/node_modules/@whatwg-node/node-fetch/cjs/utils.js +125 -0
- package/node_modules/@whatwg-node/node-fetch/esm/AbortError.js +15 -0
- package/node_modules/@whatwg-node/node-fetch/esm/Blob.js +279 -0
- package/node_modules/@whatwg-node/node-fetch/esm/Body.js +525 -0
- package/node_modules/@whatwg-node/node-fetch/esm/CompressionStream.js +29 -0
- package/node_modules/@whatwg-node/node-fetch/esm/DecompressionStream.js +29 -0
- package/node_modules/@whatwg-node/node-fetch/esm/File.js +11 -0
- package/node_modules/@whatwg-node/node-fetch/esm/FormData.js +145 -0
- package/node_modules/@whatwg-node/node-fetch/esm/Headers.js +304 -0
- package/node_modules/@whatwg-node/node-fetch/esm/IteratorObject.js +130 -0
- package/node_modules/@whatwg-node/node-fetch/esm/ReadableStream.js +241 -0
- package/node_modules/@whatwg-node/node-fetch/esm/Request.js +124 -0
- package/node_modules/@whatwg-node/node-fetch/esm/Response.js +104 -0
- package/node_modules/@whatwg-node/node-fetch/esm/TextEncoderDecoder.js +43 -0
- package/node_modules/@whatwg-node/node-fetch/esm/TextEncoderDecoderStream.js +35 -0
- package/node_modules/@whatwg-node/node-fetch/esm/TransformStream.js +75 -0
- package/node_modules/@whatwg-node/node-fetch/esm/URL.js +24 -0
- package/node_modules/@whatwg-node/node-fetch/esm/URLSearchParams.js +1 -0
- package/node_modules/@whatwg-node/node-fetch/esm/WritableStream.js +111 -0
- package/node_modules/@whatwg-node/node-fetch/esm/fetch.js +104 -0
- package/node_modules/@whatwg-node/node-fetch/esm/fetchCurl.js +139 -0
- package/node_modules/@whatwg-node/node-fetch/esm/fetchNodeHttp.js +148 -0
- package/node_modules/@whatwg-node/node-fetch/esm/index.js +18 -0
- package/node_modules/@whatwg-node/node-fetch/esm/utils.js +110 -0
- package/node_modules/@whatwg-node/node-fetch/package.json +46 -0
- package/node_modules/@whatwg-node/node-fetch/typings/AbortError.d.cts +4 -0
- package/node_modules/@whatwg-node/node-fetch/typings/AbortError.d.ts +4 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Blob.d.cts +63 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Blob.d.ts +63 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Body.d.cts +54 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Body.d.ts +54 -0
- package/node_modules/@whatwg-node/node-fetch/typings/CompressionStream.d.cts +6 -0
- package/node_modules/@whatwg-node/node-fetch/typings/CompressionStream.d.ts +6 -0
- package/node_modules/@whatwg-node/node-fetch/typings/DecompressionStream.d.cts +6 -0
- package/node_modules/@whatwg-node/node-fetch/typings/DecompressionStream.d.ts +6 -0
- package/node_modules/@whatwg-node/node-fetch/typings/File.d.cts +7 -0
- package/node_modules/@whatwg-node/node-fetch/typings/File.d.ts +7 -0
- package/node_modules/@whatwg-node/node-fetch/typings/FormData.d.cts +22 -0
- package/node_modules/@whatwg-node/node-fetch/typings/FormData.d.ts +22 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Headers.d.cts +26 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Headers.d.ts +26 -0
- package/node_modules/@whatwg-node/node-fetch/typings/IteratorObject.d.cts +20 -0
- package/node_modules/@whatwg-node/node-fetch/typings/IteratorObject.d.ts +20 -0
- package/node_modules/@whatwg-node/node-fetch/typings/ReadableStream.d.cts +27 -0
- package/node_modules/@whatwg-node/node-fetch/typings/ReadableStream.d.ts +27 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Request.d.cts +38 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Request.d.ts +38 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Response.d.cts +23 -0
- package/node_modules/@whatwg-node/node-fetch/typings/Response.d.ts +23 -0
- package/node_modules/@whatwg-node/node-fetch/typings/TextEncoderDecoder.d.cts +15 -0
- package/node_modules/@whatwg-node/node-fetch/typings/TextEncoderDecoder.d.ts +15 -0
- package/node_modules/@whatwg-node/node-fetch/typings/TextEncoderDecoderStream.d.cts +14 -0
- package/node_modules/@whatwg-node/node-fetch/typings/TextEncoderDecoderStream.d.ts +14 -0
- package/node_modules/@whatwg-node/node-fetch/typings/TransformStream.d.cts +9 -0
- package/node_modules/@whatwg-node/node-fetch/typings/TransformStream.d.ts +9 -0
- package/node_modules/@whatwg-node/node-fetch/typings/URL.d.cts +16 -0
- package/node_modules/@whatwg-node/node-fetch/typings/URL.d.ts +16 -0
- package/node_modules/@whatwg-node/node-fetch/typings/URLSearchParams.d.cts +4 -0
- package/node_modules/@whatwg-node/node-fetch/typings/URLSearchParams.d.ts +4 -0
- package/node_modules/@whatwg-node/node-fetch/typings/WritableStream.d.cts +9 -0
- package/node_modules/@whatwg-node/node-fetch/typings/WritableStream.d.ts +9 -0
- package/node_modules/@whatwg-node/node-fetch/typings/fetch.d.cts +3 -0
- package/node_modules/@whatwg-node/node-fetch/typings/fetch.d.ts +3 -0
- package/node_modules/@whatwg-node/node-fetch/typings/fetchCurl.d.cts +3 -0
- package/node_modules/@whatwg-node/node-fetch/typings/fetchCurl.d.ts +3 -0
- package/node_modules/@whatwg-node/node-fetch/typings/fetchNodeHttp.d.cts +3 -0
- package/node_modules/@whatwg-node/node-fetch/typings/fetchNodeHttp.d.ts +3 -0
- package/node_modules/@whatwg-node/node-fetch/typings/index.d.cts +18 -0
- package/node_modules/@whatwg-node/node-fetch/typings/index.d.ts +18 -0
- package/node_modules/@whatwg-node/node-fetch/typings/utils.d.cts +21 -0
- package/node_modules/@whatwg-node/node-fetch/typings/utils.d.ts +21 -0
- package/node_modules/@whatwg-node/server/package.json +2 -1
- package/node_modules/urlpattern-polyfill/LICENSE +19 -0
- package/node_modules/urlpattern-polyfill/README.md +242 -0
- package/node_modules/urlpattern-polyfill/dist/index.d.ts +9 -0
- package/node_modules/urlpattern-polyfill/dist/types.d.ts +49 -0
- package/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +1 -0
- package/node_modules/urlpattern-polyfill/dist/urlpattern.js +1 -0
- package/node_modules/urlpattern-polyfill/index.cjs +7 -0
- package/node_modules/urlpattern-polyfill/index.js +7 -0
- package/node_modules/urlpattern-polyfill/package.json +149 -0
- package/package.json +18 -8
- package/src/context.ts +1 -1
- package/src/index.ts +2 -0
- package/src/lib/map-share.ts +1 -1
- package/src/routes/maps.ts +1 -1
- package/src/types.ts +2 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { once } from 'node:events';
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
import { fakeRejectPromise } from '@whatwg-node/promise-helpers';
|
|
4
|
+
import { endStream, fakePromise, safeWrite } from './utils.js';
|
|
5
|
+
export class PonyfillWritableStream {
|
|
6
|
+
writable;
|
|
7
|
+
constructor(underlyingSink) {
|
|
8
|
+
if (underlyingSink instanceof Writable) {
|
|
9
|
+
this.writable = underlyingSink;
|
|
10
|
+
}
|
|
11
|
+
else if (underlyingSink) {
|
|
12
|
+
const writable = new Writable({
|
|
13
|
+
write(chunk, _encoding, callback) {
|
|
14
|
+
try {
|
|
15
|
+
const result = underlyingSink.write?.(chunk, controller);
|
|
16
|
+
if (result instanceof Promise) {
|
|
17
|
+
result.then(() => {
|
|
18
|
+
callback();
|
|
19
|
+
}, err => {
|
|
20
|
+
callback(err);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
callback();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
callback(err);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
final(callback) {
|
|
32
|
+
const result = underlyingSink.close?.();
|
|
33
|
+
if (result instanceof Promise) {
|
|
34
|
+
result.then(() => {
|
|
35
|
+
callback();
|
|
36
|
+
}, err => {
|
|
37
|
+
callback(err);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
callback();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
this.writable = writable;
|
|
46
|
+
const abortCtrl = new AbortController();
|
|
47
|
+
const controller = {
|
|
48
|
+
signal: abortCtrl.signal,
|
|
49
|
+
error(e) {
|
|
50
|
+
writable.destroy(e);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
writable.once('error', err => abortCtrl.abort(err));
|
|
54
|
+
writable.once('close', () => abortCtrl.abort());
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.writable = new Writable();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
getWriter() {
|
|
61
|
+
const writable = this.writable;
|
|
62
|
+
return {
|
|
63
|
+
get closed() {
|
|
64
|
+
return once(writable, 'close');
|
|
65
|
+
},
|
|
66
|
+
get desiredSize() {
|
|
67
|
+
return writable.writableLength;
|
|
68
|
+
},
|
|
69
|
+
get ready() {
|
|
70
|
+
return once(writable, 'drain');
|
|
71
|
+
},
|
|
72
|
+
releaseLock() {
|
|
73
|
+
// no-op
|
|
74
|
+
},
|
|
75
|
+
write(chunk) {
|
|
76
|
+
const promise = fakePromise();
|
|
77
|
+
if (chunk == null) {
|
|
78
|
+
return promise;
|
|
79
|
+
}
|
|
80
|
+
return promise.then(() => safeWrite(chunk, writable));
|
|
81
|
+
},
|
|
82
|
+
close() {
|
|
83
|
+
if (!writable.errored && writable.closed) {
|
|
84
|
+
return fakePromise();
|
|
85
|
+
}
|
|
86
|
+
if (writable.errored) {
|
|
87
|
+
return fakeRejectPromise(writable.errored);
|
|
88
|
+
}
|
|
89
|
+
return fakePromise().then(() => endStream(writable));
|
|
90
|
+
},
|
|
91
|
+
abort(reason) {
|
|
92
|
+
writable.destroy(reason);
|
|
93
|
+
return once(writable, 'close');
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
close() {
|
|
98
|
+
if (!this.writable.errored && this.writable.closed) {
|
|
99
|
+
return fakePromise();
|
|
100
|
+
}
|
|
101
|
+
if (this.writable.errored) {
|
|
102
|
+
return fakeRejectPromise(this.writable.errored);
|
|
103
|
+
}
|
|
104
|
+
return fakePromise().then(() => endStream(this.writable));
|
|
105
|
+
}
|
|
106
|
+
abort(reason) {
|
|
107
|
+
this.writable.destroy(reason);
|
|
108
|
+
return once(this.writable, 'close');
|
|
109
|
+
}
|
|
110
|
+
locked = false;
|
|
111
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { createReadStream, promises as fsPromises } from 'node:fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { fetchCurl } from './fetchCurl.js';
|
|
5
|
+
import { fetchNodeHttp } from './fetchNodeHttp.js';
|
|
6
|
+
import { PonyfillRequest } from './Request.js';
|
|
7
|
+
import { PonyfillResponse } from './Response.js';
|
|
8
|
+
import { PonyfillURL } from './URL.js';
|
|
9
|
+
import { fakePromise } from './utils.js';
|
|
10
|
+
const BASE64_SUFFIX = ';base64';
|
|
11
|
+
async function getResponseForFile(url) {
|
|
12
|
+
const path = fileURLToPath(url);
|
|
13
|
+
try {
|
|
14
|
+
await fsPromises.access(path, fsPromises.constants.R_OK);
|
|
15
|
+
const stats = await fsPromises.stat(path, {
|
|
16
|
+
bigint: true,
|
|
17
|
+
});
|
|
18
|
+
const readable = createReadStream(path);
|
|
19
|
+
return new PonyfillResponse(readable, {
|
|
20
|
+
status: 200,
|
|
21
|
+
statusText: 'OK',
|
|
22
|
+
headers: {
|
|
23
|
+
'content-type': 'application/octet-stream',
|
|
24
|
+
'last-modified': stats.mtime.toUTCString(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
if (err.code === 'ENOENT') {
|
|
30
|
+
return new PonyfillResponse(null, {
|
|
31
|
+
status: 404,
|
|
32
|
+
statusText: 'Not Found',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else if (err.code === 'EACCES') {
|
|
36
|
+
return new PonyfillResponse(null, {
|
|
37
|
+
status: 403,
|
|
38
|
+
statusText: 'Forbidden',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function getResponseForDataUri(url) {
|
|
45
|
+
const [mimeType = 'text/plain', ...datas] = url.substring(5).split(',');
|
|
46
|
+
const data = decodeURIComponent(datas.join(','));
|
|
47
|
+
if (mimeType.endsWith(BASE64_SUFFIX)) {
|
|
48
|
+
const buffer = Buffer.from(data, 'base64url');
|
|
49
|
+
const realMimeType = mimeType.slice(0, -BASE64_SUFFIX.length);
|
|
50
|
+
return new PonyfillResponse(buffer, {
|
|
51
|
+
status: 200,
|
|
52
|
+
statusText: 'OK',
|
|
53
|
+
headers: {
|
|
54
|
+
'content-type': realMimeType,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return new PonyfillResponse(data, {
|
|
59
|
+
status: 200,
|
|
60
|
+
statusText: 'OK',
|
|
61
|
+
headers: {
|
|
62
|
+
'content-type': mimeType,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function getResponseForBlob(url) {
|
|
67
|
+
const blob = PonyfillURL.getBlobFromURL(url);
|
|
68
|
+
if (!blob) {
|
|
69
|
+
throw new TypeError('Invalid Blob URL');
|
|
70
|
+
}
|
|
71
|
+
return new PonyfillResponse(blob, {
|
|
72
|
+
status: 200,
|
|
73
|
+
headers: {
|
|
74
|
+
'content-type': blob.type,
|
|
75
|
+
'content-length': blob.size.toString(),
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function isURL(obj) {
|
|
80
|
+
return obj != null && obj.href != null;
|
|
81
|
+
}
|
|
82
|
+
export function fetchPonyfill(info, init) {
|
|
83
|
+
if (typeof info === 'string' || isURL(info)) {
|
|
84
|
+
const ponyfillRequest = new PonyfillRequest(info, init);
|
|
85
|
+
return fetchPonyfill(ponyfillRequest);
|
|
86
|
+
}
|
|
87
|
+
const fetchRequest = info;
|
|
88
|
+
if (fetchRequest.url.startsWith('data:')) {
|
|
89
|
+
const response = getResponseForDataUri(fetchRequest.url);
|
|
90
|
+
return fakePromise(response);
|
|
91
|
+
}
|
|
92
|
+
if (fetchRequest.url.startsWith('file:')) {
|
|
93
|
+
const response = getResponseForFile(fetchRequest.url);
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
if (fetchRequest.url.startsWith('blob:')) {
|
|
97
|
+
const response = getResponseForBlob(fetchRequest.url);
|
|
98
|
+
return fakePromise(response);
|
|
99
|
+
}
|
|
100
|
+
if (globalThis.libcurl && !fetchRequest.agent) {
|
|
101
|
+
return fetchCurl(fetchRequest);
|
|
102
|
+
}
|
|
103
|
+
return fetchNodeHttp(fetchRequest);
|
|
104
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { PassThrough, Readable } from 'node:stream';
|
|
2
|
+
import { rootCertificates } from 'node:tls';
|
|
3
|
+
import { createDeferredPromise } from '@whatwg-node/promise-helpers';
|
|
4
|
+
import { PonyfillResponse } from './Response.js';
|
|
5
|
+
import { defaultHeadersSerializer, isNodeReadable, shouldRedirect } from './utils.js';
|
|
6
|
+
export function fetchCurl(fetchRequest) {
|
|
7
|
+
const { Curl, CurlFeature, CurlPause, CurlProgressFunc } = globalThis['libcurl'];
|
|
8
|
+
const curlHandle = new Curl();
|
|
9
|
+
curlHandle.enable(CurlFeature.NoDataParsing);
|
|
10
|
+
curlHandle.setOpt('URL', fetchRequest.url);
|
|
11
|
+
if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
|
|
12
|
+
curlHandle.setOpt('SSL_VERIFYPEER', false);
|
|
13
|
+
}
|
|
14
|
+
if (process.env.NODE_EXTRA_CA_CERTS) {
|
|
15
|
+
curlHandle.setOpt('CAINFO', process.env.NODE_EXTRA_CA_CERTS);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
curlHandle.setOpt('CAINFO_BLOB', rootCertificates.join('\n'));
|
|
19
|
+
}
|
|
20
|
+
curlHandle.enable(CurlFeature.StreamResponse);
|
|
21
|
+
let signal;
|
|
22
|
+
if (fetchRequest._signal === null) {
|
|
23
|
+
signal = undefined;
|
|
24
|
+
}
|
|
25
|
+
else if (fetchRequest._signal) {
|
|
26
|
+
signal = fetchRequest._signal;
|
|
27
|
+
}
|
|
28
|
+
curlHandle.setStreamProgressCallback(function () {
|
|
29
|
+
return signal?.aborted ? (process.env.DEBUG ? CurlProgressFunc.Continue : 1) : 0;
|
|
30
|
+
});
|
|
31
|
+
if (fetchRequest['bodyType'] === 'String') {
|
|
32
|
+
curlHandle.setOpt('POSTFIELDS', fetchRequest['bodyInit']);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const nodeReadable = (fetchRequest.body != null
|
|
36
|
+
? isNodeReadable(fetchRequest.body)
|
|
37
|
+
? fetchRequest.body
|
|
38
|
+
: Readable.from(fetchRequest.body)
|
|
39
|
+
: null);
|
|
40
|
+
if (nodeReadable) {
|
|
41
|
+
curlHandle.setOpt('UPLOAD', true);
|
|
42
|
+
curlHandle.setUploadStream(nodeReadable);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (process.env.DEBUG) {
|
|
46
|
+
curlHandle.setOpt('VERBOSE', true);
|
|
47
|
+
}
|
|
48
|
+
curlHandle.setOpt('TRANSFER_ENCODING', false);
|
|
49
|
+
curlHandle.setOpt('HTTP_TRANSFER_DECODING', true);
|
|
50
|
+
curlHandle.setOpt('FOLLOWLOCATION', fetchRequest.redirect === 'follow');
|
|
51
|
+
curlHandle.setOpt('MAXREDIRS', 20);
|
|
52
|
+
curlHandle.setOpt('ACCEPT_ENCODING', '');
|
|
53
|
+
curlHandle.setOpt('CUSTOMREQUEST', fetchRequest.method);
|
|
54
|
+
const headersSerializer = fetchRequest.headersSerializer || defaultHeadersSerializer;
|
|
55
|
+
let size;
|
|
56
|
+
const curlHeaders = headersSerializer(fetchRequest.headers, value => {
|
|
57
|
+
size = Number(value);
|
|
58
|
+
});
|
|
59
|
+
if (size != null) {
|
|
60
|
+
curlHandle.setOpt('INFILESIZE', size);
|
|
61
|
+
}
|
|
62
|
+
curlHandle.setOpt('HTTPHEADER', curlHeaders);
|
|
63
|
+
curlHandle.enable(CurlFeature.NoHeaderParsing);
|
|
64
|
+
const deferredPromise = createDeferredPromise();
|
|
65
|
+
let streamResolved;
|
|
66
|
+
function onAbort() {
|
|
67
|
+
if (curlHandle.isOpen) {
|
|
68
|
+
try {
|
|
69
|
+
curlHandle.pause(CurlPause.Recv);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
deferredPromise.reject(e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
77
|
+
curlHandle.once('end', function endListener() {
|
|
78
|
+
try {
|
|
79
|
+
curlHandle.close();
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
deferredPromise.reject(e);
|
|
83
|
+
}
|
|
84
|
+
signal?.removeEventListener('abort', onAbort);
|
|
85
|
+
});
|
|
86
|
+
curlHandle.once('error', function errorListener(error) {
|
|
87
|
+
if (streamResolved && !streamResolved.closed && !streamResolved.destroyed) {
|
|
88
|
+
streamResolved.destroy(error);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (error.message === 'Operation was aborted by an application callback') {
|
|
92
|
+
error.message = 'The operation was aborted.';
|
|
93
|
+
}
|
|
94
|
+
deferredPromise.reject(error);
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
curlHandle.close();
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
deferredPromise.reject(e);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
curlHandle.once('stream', function streamListener(stream, status, headersBuf) {
|
|
104
|
+
const outputStream = stream.pipe(new PassThrough(), {
|
|
105
|
+
end: true,
|
|
106
|
+
});
|
|
107
|
+
const headersFlat = headersBuf
|
|
108
|
+
.toString('utf8')
|
|
109
|
+
.split(/\r?\n|\r/g)
|
|
110
|
+
.filter(headerFilter => {
|
|
111
|
+
if (headerFilter && !headerFilter.startsWith('HTTP/')) {
|
|
112
|
+
if (fetchRequest.redirect === 'error' &&
|
|
113
|
+
headerFilter.toLowerCase().includes('location') &&
|
|
114
|
+
shouldRedirect(status)) {
|
|
115
|
+
if (!stream.destroyed) {
|
|
116
|
+
stream.resume();
|
|
117
|
+
}
|
|
118
|
+
outputStream.destroy();
|
|
119
|
+
deferredPromise.reject(new Error('redirect is not allowed'));
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
});
|
|
125
|
+
const headersInit = headersFlat.map(headerFlat => headerFlat.split(/:\s(.+)/).slice(0, 2));
|
|
126
|
+
const ponyfillResponse = new PonyfillResponse(outputStream, {
|
|
127
|
+
status,
|
|
128
|
+
headers: headersInit,
|
|
129
|
+
url: curlHandle.getInfo(Curl.info.REDIRECT_URL)?.toString() || fetchRequest.url,
|
|
130
|
+
redirected: Number(curlHandle.getInfo(Curl.info.REDIRECT_COUNT)) > 0,
|
|
131
|
+
});
|
|
132
|
+
deferredPromise.resolve(ponyfillResponse);
|
|
133
|
+
streamResolved = outputStream;
|
|
134
|
+
});
|
|
135
|
+
setImmediate(() => {
|
|
136
|
+
curlHandle.perform();
|
|
137
|
+
});
|
|
138
|
+
return deferredPromise.promise;
|
|
139
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { request as httpRequest, STATUS_CODES } from 'node:http';
|
|
2
|
+
import { request as httpsRequest } from 'node:https';
|
|
3
|
+
import { PassThrough, Readable } from 'node:stream';
|
|
4
|
+
import zlib from 'node:zlib';
|
|
5
|
+
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
|
6
|
+
import { PonyfillRequest } from './Request.js';
|
|
7
|
+
import { PonyfillResponse } from './Response.js';
|
|
8
|
+
import { PonyfillURL } from './URL.js';
|
|
9
|
+
import { DEFAULT_ACCEPT_ENCODING, endStream, getHeadersObj, isNodeReadable, pipeThrough, safeWrite, shouldRedirect, } from './utils.js';
|
|
10
|
+
function getRequestFnForProtocol(url) {
|
|
11
|
+
if (url.startsWith('http:')) {
|
|
12
|
+
return httpRequest;
|
|
13
|
+
}
|
|
14
|
+
else if (url.startsWith('https:')) {
|
|
15
|
+
return httpsRequest;
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`Unsupported protocol: ${url.split(':')[0] || url}`);
|
|
18
|
+
}
|
|
19
|
+
export function fetchNodeHttp(fetchRequest) {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
try {
|
|
22
|
+
const requestFn = getRequestFnForProtocol(fetchRequest.parsedUrl?.protocol || fetchRequest.url);
|
|
23
|
+
const headersSerializer = fetchRequest.headersSerializer || getHeadersObj;
|
|
24
|
+
const nodeHeaders = headersSerializer(fetchRequest.headers);
|
|
25
|
+
nodeHeaders['accept-encoding'] ||= DEFAULT_ACCEPT_ENCODING;
|
|
26
|
+
if (nodeHeaders['user-agent'] == null && nodeHeaders['User-Agent'] == null) {
|
|
27
|
+
nodeHeaders['user-agent'] = 'node';
|
|
28
|
+
}
|
|
29
|
+
let signal;
|
|
30
|
+
if (fetchRequest._signal == null) {
|
|
31
|
+
signal = undefined;
|
|
32
|
+
}
|
|
33
|
+
else if (fetchRequest._signal) {
|
|
34
|
+
signal = fetchRequest._signal;
|
|
35
|
+
}
|
|
36
|
+
let nodeRequest;
|
|
37
|
+
// If it is our ponyfilled Request, it should have `parsedUrl` which is a `URL` object
|
|
38
|
+
if (fetchRequest.parsedUrl) {
|
|
39
|
+
nodeRequest = requestFn(fetchRequest.parsedUrl, {
|
|
40
|
+
method: fetchRequest.method,
|
|
41
|
+
headers: nodeHeaders,
|
|
42
|
+
signal,
|
|
43
|
+
agent: fetchRequest.agent,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
nodeRequest = requestFn(fetchRequest.url, {
|
|
48
|
+
method: fetchRequest.method,
|
|
49
|
+
headers: nodeHeaders,
|
|
50
|
+
signal,
|
|
51
|
+
agent: fetchRequest.agent,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
nodeRequest.once('error', reject);
|
|
55
|
+
nodeRequest.once('response', nodeResponse => {
|
|
56
|
+
let outputStream;
|
|
57
|
+
const contentEncoding = nodeResponse.headers['content-encoding'];
|
|
58
|
+
switch (contentEncoding) {
|
|
59
|
+
case 'x-gzip':
|
|
60
|
+
case 'gzip':
|
|
61
|
+
outputStream = zlib.createGunzip();
|
|
62
|
+
break;
|
|
63
|
+
case 'x-deflate':
|
|
64
|
+
case 'deflate':
|
|
65
|
+
outputStream = zlib.createInflate();
|
|
66
|
+
break;
|
|
67
|
+
case 'x-deflate-raw':
|
|
68
|
+
case 'deflate-raw':
|
|
69
|
+
outputStream = zlib.createInflateRaw();
|
|
70
|
+
break;
|
|
71
|
+
case 'br':
|
|
72
|
+
outputStream = zlib.createBrotliDecompress();
|
|
73
|
+
break;
|
|
74
|
+
case 'zstd':
|
|
75
|
+
if (zlib.createZstdDecompress != null) {
|
|
76
|
+
outputStream = zlib.createZstdDecompress();
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
if (nodeResponse.headers.location && shouldRedirect(nodeResponse.statusCode)) {
|
|
81
|
+
if (fetchRequest.redirect === 'error') {
|
|
82
|
+
const redirectError = new Error('Redirects are not allowed');
|
|
83
|
+
reject(redirectError);
|
|
84
|
+
nodeResponse.resume();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (fetchRequest.redirect === 'follow') {
|
|
88
|
+
const redirectedUrl = new PonyfillURL(nodeResponse.headers.location, fetchRequest.parsedUrl || fetchRequest.url);
|
|
89
|
+
const redirectResponse$ = fetchNodeHttp(new PonyfillRequest(redirectedUrl, fetchRequest));
|
|
90
|
+
resolve(redirectResponse$.then(redirectResponse => {
|
|
91
|
+
redirectResponse.redirected = true;
|
|
92
|
+
return redirectResponse;
|
|
93
|
+
}));
|
|
94
|
+
nodeResponse.resume();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
outputStream ||= new PassThrough();
|
|
99
|
+
pipeThrough({
|
|
100
|
+
src: nodeResponse,
|
|
101
|
+
dest: outputStream,
|
|
102
|
+
signal,
|
|
103
|
+
onError: e => {
|
|
104
|
+
if (!nodeResponse.destroyed) {
|
|
105
|
+
nodeResponse.destroy(e);
|
|
106
|
+
}
|
|
107
|
+
if (!outputStream.destroyed) {
|
|
108
|
+
outputStream.destroy(e);
|
|
109
|
+
}
|
|
110
|
+
reject(e);
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
const statusCode = nodeResponse.statusCode || 200;
|
|
114
|
+
let statusText = nodeResponse.statusMessage || STATUS_CODES[statusCode];
|
|
115
|
+
if (statusText == null) {
|
|
116
|
+
statusText = '';
|
|
117
|
+
}
|
|
118
|
+
const ponyfillResponse = new PonyfillResponse(outputStream || nodeResponse, {
|
|
119
|
+
status: statusCode,
|
|
120
|
+
statusText,
|
|
121
|
+
headers: nodeResponse.headers,
|
|
122
|
+
url: fetchRequest.url,
|
|
123
|
+
signal,
|
|
124
|
+
});
|
|
125
|
+
resolve(ponyfillResponse);
|
|
126
|
+
});
|
|
127
|
+
if (fetchRequest['_buffer'] != null) {
|
|
128
|
+
handleMaybePromise(() => safeWrite(fetchRequest['_buffer'], nodeRequest), () => endStream(nodeRequest), reject);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const nodeReadable = (fetchRequest.body != null
|
|
132
|
+
? isNodeReadable(fetchRequest.body)
|
|
133
|
+
? fetchRequest.body
|
|
134
|
+
: Readable.from(fetchRequest.body)
|
|
135
|
+
: null);
|
|
136
|
+
if (nodeReadable) {
|
|
137
|
+
nodeReadable.pipe(nodeRequest);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
endStream(nodeRequest);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
reject(e);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { fetchPonyfill as fetch } from './fetch.js';
|
|
2
|
+
export { PonyfillHeaders as Headers } from './Headers.js';
|
|
3
|
+
export { PonyfillBody as Body } from './Body.js';
|
|
4
|
+
export { PonyfillRequest as Request } from './Request.js';
|
|
5
|
+
export { PonyfillResponse as Response, } from './Response.js';
|
|
6
|
+
export { PonyfillReadableStream as ReadableStream } from './ReadableStream.js';
|
|
7
|
+
export { PonyfillFile as File } from './File.js';
|
|
8
|
+
export { PonyfillFormData as FormData } from './FormData.js';
|
|
9
|
+
export { PonyfillBlob as Blob } from './Blob.js';
|
|
10
|
+
export { PonyfillTextEncoder as TextEncoder, PonyfillTextDecoder as TextDecoder, PonyfillBtoa as btoa, } from './TextEncoderDecoder.js';
|
|
11
|
+
export { PonyfillURL as URL } from './URL.js';
|
|
12
|
+
export { PonyfillURLSearchParams as URLSearchParams } from './URLSearchParams.js';
|
|
13
|
+
export { PonyfillWritableStream as WritableStream } from './WritableStream.js';
|
|
14
|
+
export { PonyfillTransformStream as TransformStream } from './TransformStream.js';
|
|
15
|
+
export { PonyfillCompressionStream as CompressionStream } from './CompressionStream.js';
|
|
16
|
+
export { PonyfillDecompressionStream as DecompressionStream } from './DecompressionStream.js';
|
|
17
|
+
export { PonyfillIteratorObject as IteratorObject } from './IteratorObject.js';
|
|
18
|
+
export { PonyfillTextDecoderStream as TextDecoderStream, PonyfillTextEncoderStream as TextEncoderStream, } from './TextEncoderDecoderStream.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { once } from 'node:events';
|
|
2
|
+
import zlib from 'node:zlib';
|
|
3
|
+
function isHeadersInstance(obj) {
|
|
4
|
+
return obj?.forEach != null;
|
|
5
|
+
}
|
|
6
|
+
export function getHeadersObj(headers) {
|
|
7
|
+
if (headers == null || !isHeadersInstance(headers)) {
|
|
8
|
+
return headers;
|
|
9
|
+
}
|
|
10
|
+
// @ts-expect-error - `headersInit` is not a public property
|
|
11
|
+
if (headers.headersInit && !headers._map && !isHeadersInstance(headers.headersInit)) {
|
|
12
|
+
// @ts-expect-error - `headersInit` is not a public property
|
|
13
|
+
return headers.headersInit;
|
|
14
|
+
}
|
|
15
|
+
return Object.fromEntries(headers.entries());
|
|
16
|
+
}
|
|
17
|
+
export function defaultHeadersSerializer(headers, onContentLength) {
|
|
18
|
+
const headerArray = [];
|
|
19
|
+
headers.forEach((value, key) => {
|
|
20
|
+
if (onContentLength && key === 'content-length') {
|
|
21
|
+
onContentLength(value);
|
|
22
|
+
}
|
|
23
|
+
headerArray.push(`${key}: ${value}`);
|
|
24
|
+
});
|
|
25
|
+
return headerArray;
|
|
26
|
+
}
|
|
27
|
+
export { fakePromise } from '@whatwg-node/promise-helpers';
|
|
28
|
+
export function isArrayBufferView(obj) {
|
|
29
|
+
return obj != null && obj.buffer != null && obj.byteLength != null && obj.byteOffset != null;
|
|
30
|
+
}
|
|
31
|
+
export function isNodeReadable(obj) {
|
|
32
|
+
return obj != null && obj.pipe != null;
|
|
33
|
+
}
|
|
34
|
+
export function isIterable(value) {
|
|
35
|
+
return value?.[Symbol.iterator] != null;
|
|
36
|
+
}
|
|
37
|
+
export function shouldRedirect(status) {
|
|
38
|
+
return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;
|
|
39
|
+
}
|
|
40
|
+
export function pipeThrough({ src, dest, signal, onError, }) {
|
|
41
|
+
if (onError) {
|
|
42
|
+
// listen for errors on the destination stream if necessary. if the readable
|
|
43
|
+
// stream (src) emits an error, the writable destination (dest) will be
|
|
44
|
+
// destroyed with that error (see below)
|
|
45
|
+
dest.once('error', onError);
|
|
46
|
+
}
|
|
47
|
+
src.once('error', (e) => {
|
|
48
|
+
// if the readable stream (src) emits an error during pipe, the writable
|
|
49
|
+
// destination (dest) is not closed automatically. that needs to be
|
|
50
|
+
// done manually. the readable stream is closed when error is emitted,
|
|
51
|
+
// so only the writable destination needs to be destroyed
|
|
52
|
+
dest.destroy(e);
|
|
53
|
+
});
|
|
54
|
+
dest.once('close', () => {
|
|
55
|
+
// if the writable destination (dest) is closed, the readable stream (src)
|
|
56
|
+
// is not closed automatically. that needs to be done manually
|
|
57
|
+
if (!src.destroyed) {
|
|
58
|
+
src.destroy();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if (signal) {
|
|
62
|
+
// this is faster than `import('node:signal').addAbortSignal(signal, src)`
|
|
63
|
+
const srcRef = new WeakRef(src);
|
|
64
|
+
const signalRef = new WeakRef(signal);
|
|
65
|
+
function cleanup() {
|
|
66
|
+
signalRef.deref()?.removeEventListener('abort', onAbort);
|
|
67
|
+
srcRef.deref()?.removeListener('end', cleanup);
|
|
68
|
+
srcRef.deref()?.removeListener('error', cleanup);
|
|
69
|
+
srcRef.deref()?.removeListener('close', cleanup);
|
|
70
|
+
}
|
|
71
|
+
function onAbort() {
|
|
72
|
+
srcRef.deref()?.destroy(new AbortError());
|
|
73
|
+
cleanup();
|
|
74
|
+
}
|
|
75
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
76
|
+
// this is faster than `import('node:signal').finished(src, cleanup)`
|
|
77
|
+
src.once('end', cleanup);
|
|
78
|
+
src.once('error', cleanup);
|
|
79
|
+
src.once('close', cleanup);
|
|
80
|
+
}
|
|
81
|
+
src.pipe(dest, { end: true /* already default */ });
|
|
82
|
+
}
|
|
83
|
+
export function endStream(stream) {
|
|
84
|
+
// @ts-expect-error Avoid arguments adaptor trampoline https://v8.dev/blog/adaptor-frame
|
|
85
|
+
return stream.end(null, null, null);
|
|
86
|
+
}
|
|
87
|
+
export function safeWrite(chunk, stream) {
|
|
88
|
+
const result = stream.write(chunk);
|
|
89
|
+
if (!result) {
|
|
90
|
+
return once(stream, 'drain');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// https://github.com/nodejs/node/blob/f692878dec6354c0a82241f224906981861bc840/lib/internal/errors.js#L961-L973
|
|
94
|
+
class AbortError extends Error {
|
|
95
|
+
constructor(message = 'The operation was aborted', options = undefined) {
|
|
96
|
+
super(message, options);
|
|
97
|
+
this.name = 'AbortError';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export const DEFAULT_ACCEPT_ENCODING = getSupportedFormats().join(', ');
|
|
101
|
+
export function getSupportedFormats() {
|
|
102
|
+
const baseFormats = ['gzip', 'deflate', 'br'];
|
|
103
|
+
if (!globalThis.process?.versions?.node?.startsWith('2')) {
|
|
104
|
+
baseFormats.push('deflate-raw');
|
|
105
|
+
}
|
|
106
|
+
if (zlib.createZstdCompress != null) {
|
|
107
|
+
baseFormats.push('zstd');
|
|
108
|
+
}
|
|
109
|
+
return baseFormats;
|
|
110
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@whatwg-node/node-fetch",
|
|
3
|
+
"version": "0.8.4",
|
|
4
|
+
"description": "Fetch API implementation for Node",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@fastify/busboy": "^3.1.1",
|
|
8
|
+
"@whatwg-node/disposablestack": "^0.0.6",
|
|
9
|
+
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
10
|
+
"tslib": "^2.6.3"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "ardatan/whatwg-node",
|
|
15
|
+
"directory": "packages/node-fetch"
|
|
16
|
+
},
|
|
17
|
+
"author": "Arda TANRIKULU <ardatanrikulu@gmail.com>",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18.0.0"
|
|
21
|
+
},
|
|
22
|
+
"main": "cjs/index.js",
|
|
23
|
+
"module": "esm/index.js",
|
|
24
|
+
"typings": "typings/index.d.ts",
|
|
25
|
+
"typescript": {
|
|
26
|
+
"definition": "typings/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./typings/index.d.cts",
|
|
33
|
+
"default": "./cjs/index.js"
|
|
34
|
+
},
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./typings/index.d.ts",
|
|
37
|
+
"default": "./esm/index.js"
|
|
38
|
+
},
|
|
39
|
+
"default": {
|
|
40
|
+
"types": "./typings/index.d.ts",
|
|
41
|
+
"default": "./esm/index.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
}
|
|
46
|
+
}
|