Spaces:
Configuration error
Configuration error
luigi12345
commited on
Commit
•
3acab94
1
Parent(s):
82c35a0
92d4048cd7422ca700e4f25d890dda00136a542d5b5185aceccbba5d6d6d93af
Browse files- workers1/auto3d/node_modules/@jridgewell/resolve-uri/README.md +40 -0
- workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +232 -0
- workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +1 -0
- workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +240 -0
- workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +1 -0
- workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +4 -0
- workers1/auto3d/node_modules/@jridgewell/resolve-uri/package.json +69 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/LICENSE +21 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/README.md +264 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +424 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +439 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +1 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts +49 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +8 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts +15 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts +6 -0
- workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/package.json +75 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/LICENSE +19 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/README.md +193 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +514 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +1 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +528 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +1 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +8 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +32 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +7 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts +1 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts +2 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts +4 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +70 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +85 -0
- workers1/auto3d/node_modules/@jridgewell/trace-mapping/package.json +70 -0
- workers1/auto3d/node_modules/@types/node/LICENSE +21 -0
- workers1/auto3d/node_modules/@types/node/README.md +15 -0
- workers1/auto3d/node_modules/@types/node/assert.d.ts +1040 -0
- workers1/auto3d/node_modules/@types/node/assert/strict.d.ts +8 -0
- workers1/auto3d/node_modules/@types/node/async_hooks.d.ts +541 -0
- workers1/auto3d/node_modules/@types/node/buffer.d.ts +0 -0
- workers1/auto3d/node_modules/@types/node/child_process.d.ts +1544 -0
- workers1/auto3d/node_modules/@types/node/cluster.d.ts +578 -0
- workers1/auto3d/node_modules/@types/node/console.d.ts +452 -0
- workers1/auto3d/node_modules/@types/node/constants.d.ts +19 -0
- workers1/auto3d/node_modules/@types/node/crypto.d.ts +0 -0
- workers1/auto3d/node_modules/@types/node/dgram.d.ts +596 -0
- workers1/auto3d/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- workers1/auto3d/node_modules/@types/node/dns.d.ts +865 -0
- workers1/auto3d/node_modules/@types/node/dns/promises.d.ts +476 -0
- workers1/auto3d/node_modules/@types/node/dom-events.d.ts +124 -0
workers1/auto3d/node_modules/@jridgewell/resolve-uri/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# @jridgewell/resolve-uri
|
2 |
+
|
3 |
+
> Resolve a URI relative to an optional base URI
|
4 |
+
|
5 |
+
Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.
|
6 |
+
|
7 |
+
## Installation
|
8 |
+
|
9 |
+
```sh
|
10 |
+
npm install @jridgewell/resolve-uri
|
11 |
+
```
|
12 |
+
|
13 |
+
## Usage
|
14 |
+
|
15 |
+
```typescript
|
16 |
+
function resolve(input: string, base?: string): string;
|
17 |
+
```
|
18 |
+
|
19 |
+
```js
|
20 |
+
import resolve from '@jridgewell/resolve-uri';
|
21 |
+
|
22 |
+
resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
|
23 |
+
```
|
24 |
+
|
25 |
+
| Input | Base | Resolution | Explanation |
|
26 |
+
|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------|
|
27 |
+
| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only |
|
28 |
+
| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol |
|
29 |
+
| `//example.com` | _rest_ | `//example.com/` | Input is normalized only |
|
30 |
+
| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin |
|
31 |
+
| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative |
|
32 |
+
| `/example` | _rest_ | `/example` | Input is normalized only |
|
33 |
+
| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base |
|
34 |
+
| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file |
|
35 |
+
| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory |
|
36 |
+
| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file |
|
37 |
+
| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory |
|
38 |
+
| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file |
|
39 |
+
| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory |
|
40 |
+
| `example` | `base/file` | `base/example` | Input is joined with the base without its file |
|
workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Matches the scheme of a URL, eg "http://"
|
2 |
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
3 |
+
/**
|
4 |
+
* Matches the parts of a URL:
|
5 |
+
* 1. Scheme, including ":", guaranteed.
|
6 |
+
* 2. User/password, including "@", optional.
|
7 |
+
* 3. Host, guaranteed.
|
8 |
+
* 4. Port, including ":", optional.
|
9 |
+
* 5. Path, including "/", optional.
|
10 |
+
* 6. Query, including "?", optional.
|
11 |
+
* 7. Hash, including "#", optional.
|
12 |
+
*/
|
13 |
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
14 |
+
/**
|
15 |
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
16 |
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
17 |
+
*
|
18 |
+
* 1. Host, optional.
|
19 |
+
* 2. Path, which may include "/", guaranteed.
|
20 |
+
* 3. Query, including "?", optional.
|
21 |
+
* 4. Hash, including "#", optional.
|
22 |
+
*/
|
23 |
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
24 |
+
function isAbsoluteUrl(input) {
|
25 |
+
return schemeRegex.test(input);
|
26 |
+
}
|
27 |
+
function isSchemeRelativeUrl(input) {
|
28 |
+
return input.startsWith('//');
|
29 |
+
}
|
30 |
+
function isAbsolutePath(input) {
|
31 |
+
return input.startsWith('/');
|
32 |
+
}
|
33 |
+
function isFileUrl(input) {
|
34 |
+
return input.startsWith('file:');
|
35 |
+
}
|
36 |
+
function isRelative(input) {
|
37 |
+
return /^[.?#]/.test(input);
|
38 |
+
}
|
39 |
+
function parseAbsoluteUrl(input) {
|
40 |
+
const match = urlRegex.exec(input);
|
41 |
+
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
|
42 |
+
}
|
43 |
+
function parseFileUrl(input) {
|
44 |
+
const match = fileRegex.exec(input);
|
45 |
+
const path = match[2];
|
46 |
+
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
|
47 |
+
}
|
48 |
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
49 |
+
return {
|
50 |
+
scheme,
|
51 |
+
user,
|
52 |
+
host,
|
53 |
+
port,
|
54 |
+
path,
|
55 |
+
query,
|
56 |
+
hash,
|
57 |
+
type: 7 /* Absolute */,
|
58 |
+
};
|
59 |
+
}
|
60 |
+
function parseUrl(input) {
|
61 |
+
if (isSchemeRelativeUrl(input)) {
|
62 |
+
const url = parseAbsoluteUrl('http:' + input);
|
63 |
+
url.scheme = '';
|
64 |
+
url.type = 6 /* SchemeRelative */;
|
65 |
+
return url;
|
66 |
+
}
|
67 |
+
if (isAbsolutePath(input)) {
|
68 |
+
const url = parseAbsoluteUrl('http://foo.com' + input);
|
69 |
+
url.scheme = '';
|
70 |
+
url.host = '';
|
71 |
+
url.type = 5 /* AbsolutePath */;
|
72 |
+
return url;
|
73 |
+
}
|
74 |
+
if (isFileUrl(input))
|
75 |
+
return parseFileUrl(input);
|
76 |
+
if (isAbsoluteUrl(input))
|
77 |
+
return parseAbsoluteUrl(input);
|
78 |
+
const url = parseAbsoluteUrl('http://foo.com/' + input);
|
79 |
+
url.scheme = '';
|
80 |
+
url.host = '';
|
81 |
+
url.type = input
|
82 |
+
? input.startsWith('?')
|
83 |
+
? 3 /* Query */
|
84 |
+
: input.startsWith('#')
|
85 |
+
? 2 /* Hash */
|
86 |
+
: 4 /* RelativePath */
|
87 |
+
: 1 /* Empty */;
|
88 |
+
return url;
|
89 |
+
}
|
90 |
+
function stripPathFilename(path) {
|
91 |
+
// If a path ends with a parent directory "..", then it's a relative path with excess parent
|
92 |
+
// paths. It's not a file, so we can't strip it.
|
93 |
+
if (path.endsWith('/..'))
|
94 |
+
return path;
|
95 |
+
const index = path.lastIndexOf('/');
|
96 |
+
return path.slice(0, index + 1);
|
97 |
+
}
|
98 |
+
function mergePaths(url, base) {
|
99 |
+
normalizePath(base, base.type);
|
100 |
+
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
|
101 |
+
// path).
|
102 |
+
if (url.path === '/') {
|
103 |
+
url.path = base.path;
|
104 |
+
}
|
105 |
+
else {
|
106 |
+
// Resolution happens relative to the base path's directory, not the file.
|
107 |
+
url.path = stripPathFilename(base.path) + url.path;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
/**
|
111 |
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
112 |
+
* "foo/.". We need to normalize to a standard representation.
|
113 |
+
*/
|
114 |
+
function normalizePath(url, type) {
|
115 |
+
const rel = type <= 4 /* RelativePath */;
|
116 |
+
const pieces = url.path.split('/');
|
117 |
+
// We need to preserve the first piece always, so that we output a leading slash. The item at
|
118 |
+
// pieces[0] is an empty string.
|
119 |
+
let pointer = 1;
|
120 |
+
// Positive is the number of real directories we've output, used for popping a parent directory.
|
121 |
+
// Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
|
122 |
+
let positive = 0;
|
123 |
+
// We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
|
124 |
+
// generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
|
125 |
+
// real directory, we won't need to append, unless the other conditions happen again.
|
126 |
+
let addTrailingSlash = false;
|
127 |
+
for (let i = 1; i < pieces.length; i++) {
|
128 |
+
const piece = pieces[i];
|
129 |
+
// An empty directory, could be a trailing slash, or just a double "//" in the path.
|
130 |
+
if (!piece) {
|
131 |
+
addTrailingSlash = true;
|
132 |
+
continue;
|
133 |
+
}
|
134 |
+
// If we encounter a real directory, then we don't need to append anymore.
|
135 |
+
addTrailingSlash = false;
|
136 |
+
// A current directory, which we can always drop.
|
137 |
+
if (piece === '.')
|
138 |
+
continue;
|
139 |
+
// A parent directory, we need to see if there are any real directories we can pop. Else, we
|
140 |
+
// have an excess of parents, and we'll need to keep the "..".
|
141 |
+
if (piece === '..') {
|
142 |
+
if (positive) {
|
143 |
+
addTrailingSlash = true;
|
144 |
+
positive--;
|
145 |
+
pointer--;
|
146 |
+
}
|
147 |
+
else if (rel) {
|
148 |
+
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
|
149 |
+
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
|
150 |
+
pieces[pointer++] = piece;
|
151 |
+
}
|
152 |
+
continue;
|
153 |
+
}
|
154 |
+
// We've encountered a real directory. Move it to the next insertion pointer, which accounts for
|
155 |
+
// any popped or dropped directories.
|
156 |
+
pieces[pointer++] = piece;
|
157 |
+
positive++;
|
158 |
+
}
|
159 |
+
let path = '';
|
160 |
+
for (let i = 1; i < pointer; i++) {
|
161 |
+
path += '/' + pieces[i];
|
162 |
+
}
|
163 |
+
if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
|
164 |
+
path += '/';
|
165 |
+
}
|
166 |
+
url.path = path;
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* Attempts to resolve `input` URL/path relative to `base`.
|
170 |
+
*/
|
171 |
+
function resolve(input, base) {
|
172 |
+
if (!input && !base)
|
173 |
+
return '';
|
174 |
+
const url = parseUrl(input);
|
175 |
+
let inputType = url.type;
|
176 |
+
if (base && inputType !== 7 /* Absolute */) {
|
177 |
+
const baseUrl = parseUrl(base);
|
178 |
+
const baseType = baseUrl.type;
|
179 |
+
switch (inputType) {
|
180 |
+
case 1 /* Empty */:
|
181 |
+
url.hash = baseUrl.hash;
|
182 |
+
// fall through
|
183 |
+
case 2 /* Hash */:
|
184 |
+
url.query = baseUrl.query;
|
185 |
+
// fall through
|
186 |
+
case 3 /* Query */:
|
187 |
+
case 4 /* RelativePath */:
|
188 |
+
mergePaths(url, baseUrl);
|
189 |
+
// fall through
|
190 |
+
case 5 /* AbsolutePath */:
|
191 |
+
// The host, user, and port are joined, you can't copy one without the others.
|
192 |
+
url.user = baseUrl.user;
|
193 |
+
url.host = baseUrl.host;
|
194 |
+
url.port = baseUrl.port;
|
195 |
+
// fall through
|
196 |
+
case 6 /* SchemeRelative */:
|
197 |
+
// The input doesn't have a schema at least, so we need to copy at least that over.
|
198 |
+
url.scheme = baseUrl.scheme;
|
199 |
+
}
|
200 |
+
if (baseType > inputType)
|
201 |
+
inputType = baseType;
|
202 |
+
}
|
203 |
+
normalizePath(url, inputType);
|
204 |
+
const queryHash = url.query + url.hash;
|
205 |
+
switch (inputType) {
|
206 |
+
// This is impossible, because of the empty checks at the start of the function.
|
207 |
+
// case UrlType.Empty:
|
208 |
+
case 2 /* Hash */:
|
209 |
+
case 3 /* Query */:
|
210 |
+
return queryHash;
|
211 |
+
case 4 /* RelativePath */: {
|
212 |
+
// The first char is always a "/", and we need it to be relative.
|
213 |
+
const path = url.path.slice(1);
|
214 |
+
if (!path)
|
215 |
+
return queryHash || '.';
|
216 |
+
if (isRelative(base || input) && !isRelative(path)) {
|
217 |
+
// If base started with a leading ".", or there is no base and input started with a ".",
|
218 |
+
// then we need to ensure that the relative path starts with a ".". We don't know if
|
219 |
+
// relative starts with a "..", though, so check before prepending.
|
220 |
+
return './' + path + queryHash;
|
221 |
+
}
|
222 |
+
return path + queryHash;
|
223 |
+
}
|
224 |
+
case 5 /* AbsolutePath */:
|
225 |
+
return url.path + queryHash;
|
226 |
+
default:
|
227 |
+
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
export { resolve as default };
|
232 |
+
//# sourceMappingURL=resolve-uri.mjs.map
|
workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"resolve-uri.mjs","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":"AAAA;AACA,MAAM,WAAW,GAAG,gBAAgB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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (global, factory) {
|
2 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
4 |
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory());
|
5 |
+
})(this, (function () { 'use strict';
|
6 |
+
|
7 |
+
// Matches the scheme of a URL, eg "http://"
|
8 |
+
const schemeRegex = /^[\w+.-]+:\/\//;
|
9 |
+
/**
|
10 |
+
* Matches the parts of a URL:
|
11 |
+
* 1. Scheme, including ":", guaranteed.
|
12 |
+
* 2. User/password, including "@", optional.
|
13 |
+
* 3. Host, guaranteed.
|
14 |
+
* 4. Port, including ":", optional.
|
15 |
+
* 5. Path, including "/", optional.
|
16 |
+
* 6. Query, including "?", optional.
|
17 |
+
* 7. Hash, including "#", optional.
|
18 |
+
*/
|
19 |
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
20 |
+
/**
|
21 |
+
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
22 |
+
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
23 |
+
*
|
24 |
+
* 1. Host, optional.
|
25 |
+
* 2. Path, which may include "/", guaranteed.
|
26 |
+
* 3. Query, including "?", optional.
|
27 |
+
* 4. Hash, including "#", optional.
|
28 |
+
*/
|
29 |
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
30 |
+
function isAbsoluteUrl(input) {
|
31 |
+
return schemeRegex.test(input);
|
32 |
+
}
|
33 |
+
function isSchemeRelativeUrl(input) {
|
34 |
+
return input.startsWith('//');
|
35 |
+
}
|
36 |
+
function isAbsolutePath(input) {
|
37 |
+
return input.startsWith('/');
|
38 |
+
}
|
39 |
+
function isFileUrl(input) {
|
40 |
+
return input.startsWith('file:');
|
41 |
+
}
|
42 |
+
function isRelative(input) {
|
43 |
+
return /^[.?#]/.test(input);
|
44 |
+
}
|
45 |
+
function parseAbsoluteUrl(input) {
|
46 |
+
const match = urlRegex.exec(input);
|
47 |
+
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
|
48 |
+
}
|
49 |
+
function parseFileUrl(input) {
|
50 |
+
const match = fileRegex.exec(input);
|
51 |
+
const path = match[2];
|
52 |
+
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
|
53 |
+
}
|
54 |
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
55 |
+
return {
|
56 |
+
scheme,
|
57 |
+
user,
|
58 |
+
host,
|
59 |
+
port,
|
60 |
+
path,
|
61 |
+
query,
|
62 |
+
hash,
|
63 |
+
type: 7 /* Absolute */,
|
64 |
+
};
|
65 |
+
}
|
66 |
+
function parseUrl(input) {
|
67 |
+
if (isSchemeRelativeUrl(input)) {
|
68 |
+
const url = parseAbsoluteUrl('http:' + input);
|
69 |
+
url.scheme = '';
|
70 |
+
url.type = 6 /* SchemeRelative */;
|
71 |
+
return url;
|
72 |
+
}
|
73 |
+
if (isAbsolutePath(input)) {
|
74 |
+
const url = parseAbsoluteUrl('http://foo.com' + input);
|
75 |
+
url.scheme = '';
|
76 |
+
url.host = '';
|
77 |
+
url.type = 5 /* AbsolutePath */;
|
78 |
+
return url;
|
79 |
+
}
|
80 |
+
if (isFileUrl(input))
|
81 |
+
return parseFileUrl(input);
|
82 |
+
if (isAbsoluteUrl(input))
|
83 |
+
return parseAbsoluteUrl(input);
|
84 |
+
const url = parseAbsoluteUrl('http://foo.com/' + input);
|
85 |
+
url.scheme = '';
|
86 |
+
url.host = '';
|
87 |
+
url.type = input
|
88 |
+
? input.startsWith('?')
|
89 |
+
? 3 /* Query */
|
90 |
+
: input.startsWith('#')
|
91 |
+
? 2 /* Hash */
|
92 |
+
: 4 /* RelativePath */
|
93 |
+
: 1 /* Empty */;
|
94 |
+
return url;
|
95 |
+
}
|
96 |
+
function stripPathFilename(path) {
|
97 |
+
// If a path ends with a parent directory "..", then it's a relative path with excess parent
|
98 |
+
// paths. It's not a file, so we can't strip it.
|
99 |
+
if (path.endsWith('/..'))
|
100 |
+
return path;
|
101 |
+
const index = path.lastIndexOf('/');
|
102 |
+
return path.slice(0, index + 1);
|
103 |
+
}
|
104 |
+
function mergePaths(url, base) {
|
105 |
+
normalizePath(base, base.type);
|
106 |
+
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
|
107 |
+
// path).
|
108 |
+
if (url.path === '/') {
|
109 |
+
url.path = base.path;
|
110 |
+
}
|
111 |
+
else {
|
112 |
+
// Resolution happens relative to the base path's directory, not the file.
|
113 |
+
url.path = stripPathFilename(base.path) + url.path;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
/**
|
117 |
+
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
118 |
+
* "foo/.". We need to normalize to a standard representation.
|
119 |
+
*/
|
120 |
+
function normalizePath(url, type) {
|
121 |
+
const rel = type <= 4 /* RelativePath */;
|
122 |
+
const pieces = url.path.split('/');
|
123 |
+
// We need to preserve the first piece always, so that we output a leading slash. The item at
|
124 |
+
// pieces[0] is an empty string.
|
125 |
+
let pointer = 1;
|
126 |
+
// Positive is the number of real directories we've output, used for popping a parent directory.
|
127 |
+
// Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
|
128 |
+
let positive = 0;
|
129 |
+
// We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
|
130 |
+
// generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
|
131 |
+
// real directory, we won't need to append, unless the other conditions happen again.
|
132 |
+
let addTrailingSlash = false;
|
133 |
+
for (let i = 1; i < pieces.length; i++) {
|
134 |
+
const piece = pieces[i];
|
135 |
+
// An empty directory, could be a trailing slash, or just a double "//" in the path.
|
136 |
+
if (!piece) {
|
137 |
+
addTrailingSlash = true;
|
138 |
+
continue;
|
139 |
+
}
|
140 |
+
// If we encounter a real directory, then we don't need to append anymore.
|
141 |
+
addTrailingSlash = false;
|
142 |
+
// A current directory, which we can always drop.
|
143 |
+
if (piece === '.')
|
144 |
+
continue;
|
145 |
+
// A parent directory, we need to see if there are any real directories we can pop. Else, we
|
146 |
+
// have an excess of parents, and we'll need to keep the "..".
|
147 |
+
if (piece === '..') {
|
148 |
+
if (positive) {
|
149 |
+
addTrailingSlash = true;
|
150 |
+
positive--;
|
151 |
+
pointer--;
|
152 |
+
}
|
153 |
+
else if (rel) {
|
154 |
+
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
|
155 |
+
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
|
156 |
+
pieces[pointer++] = piece;
|
157 |
+
}
|
158 |
+
continue;
|
159 |
+
}
|
160 |
+
// We've encountered a real directory. Move it to the next insertion pointer, which accounts for
|
161 |
+
// any popped or dropped directories.
|
162 |
+
pieces[pointer++] = piece;
|
163 |
+
positive++;
|
164 |
+
}
|
165 |
+
let path = '';
|
166 |
+
for (let i = 1; i < pointer; i++) {
|
167 |
+
path += '/' + pieces[i];
|
168 |
+
}
|
169 |
+
if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
|
170 |
+
path += '/';
|
171 |
+
}
|
172 |
+
url.path = path;
|
173 |
+
}
|
174 |
+
/**
|
175 |
+
* Attempts to resolve `input` URL/path relative to `base`.
|
176 |
+
*/
|
177 |
+
function resolve(input, base) {
|
178 |
+
if (!input && !base)
|
179 |
+
return '';
|
180 |
+
const url = parseUrl(input);
|
181 |
+
let inputType = url.type;
|
182 |
+
if (base && inputType !== 7 /* Absolute */) {
|
183 |
+
const baseUrl = parseUrl(base);
|
184 |
+
const baseType = baseUrl.type;
|
185 |
+
switch (inputType) {
|
186 |
+
case 1 /* Empty */:
|
187 |
+
url.hash = baseUrl.hash;
|
188 |
+
// fall through
|
189 |
+
case 2 /* Hash */:
|
190 |
+
url.query = baseUrl.query;
|
191 |
+
// fall through
|
192 |
+
case 3 /* Query */:
|
193 |
+
case 4 /* RelativePath */:
|
194 |
+
mergePaths(url, baseUrl);
|
195 |
+
// fall through
|
196 |
+
case 5 /* AbsolutePath */:
|
197 |
+
// The host, user, and port are joined, you can't copy one without the others.
|
198 |
+
url.user = baseUrl.user;
|
199 |
+
url.host = baseUrl.host;
|
200 |
+
url.port = baseUrl.port;
|
201 |
+
// fall through
|
202 |
+
case 6 /* SchemeRelative */:
|
203 |
+
// The input doesn't have a schema at least, so we need to copy at least that over.
|
204 |
+
url.scheme = baseUrl.scheme;
|
205 |
+
}
|
206 |
+
if (baseType > inputType)
|
207 |
+
inputType = baseType;
|
208 |
+
}
|
209 |
+
normalizePath(url, inputType);
|
210 |
+
const queryHash = url.query + url.hash;
|
211 |
+
switch (inputType) {
|
212 |
+
// This is impossible, because of the empty checks at the start of the function.
|
213 |
+
// case UrlType.Empty:
|
214 |
+
case 2 /* Hash */:
|
215 |
+
case 3 /* Query */:
|
216 |
+
return queryHash;
|
217 |
+
case 4 /* RelativePath */: {
|
218 |
+
// The first char is always a "/", and we need it to be relative.
|
219 |
+
const path = url.path.slice(1);
|
220 |
+
if (!path)
|
221 |
+
return queryHash || '.';
|
222 |
+
if (isRelative(base || input) && !isRelative(path)) {
|
223 |
+
// If base started with a leading ".", or there is no base and input started with a ".",
|
224 |
+
// then we need to ensure that the relative path starts with a ".". We don't know if
|
225 |
+
// relative starts with a "..", though, so check before prepending.
|
226 |
+
return './' + path + queryHash;
|
227 |
+
}
|
228 |
+
return path + queryHash;
|
229 |
+
}
|
230 |
+
case 5 /* AbsolutePath */:
|
231 |
+
return url.path + queryHash;
|
232 |
+
default:
|
233 |
+
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
return resolve;
|
238 |
+
|
239 |
+
}));
|
240 |
+
//# sourceMappingURL=resolve-uri.umd.js.map
|
workers1/auto3d/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"resolve-uri.umd.js","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA,MAAM,WAAW,GAAG,gBAAgB,CAAC;IAErC;;;;;;;;;;IAUA,MAAM,QAAQ,GAAG,0EAA0E,CAAC;IAE5F;;;;;;;;;IASA,MAAM,SAAS,GAAG,iEAAiE,CAAC;IAuBpF,SAAS,aAAa,CAAC,KAAa;QAClC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,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
* Attempts to resolve `input` URL/path relative to `base`.
|
3 |
+
*/
|
4 |
+
export default function resolve(input: string, base: string | undefined): string;
|
workers1/auto3d/node_modules/@jridgewell/resolve-uri/package.json
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@jridgewell/resolve-uri",
|
3 |
+
"version": "3.1.2",
|
4 |
+
"description": "Resolve a URI relative to an optional base URI",
|
5 |
+
"keywords": [
|
6 |
+
"resolve",
|
7 |
+
"uri",
|
8 |
+
"url",
|
9 |
+
"path"
|
10 |
+
],
|
11 |
+
"author": "Justin Ridgewell <[email protected]>",
|
12 |
+
"license": "MIT",
|
13 |
+
"repository": "https://github.com/jridgewell/resolve-uri",
|
14 |
+
"main": "dist/resolve-uri.umd.js",
|
15 |
+
"module": "dist/resolve-uri.mjs",
|
16 |
+
"types": "dist/types/resolve-uri.d.ts",
|
17 |
+
"exports": {
|
18 |
+
".": [
|
19 |
+
{
|
20 |
+
"types": "./dist/types/resolve-uri.d.ts",
|
21 |
+
"browser": "./dist/resolve-uri.umd.js",
|
22 |
+
"require": "./dist/resolve-uri.umd.js",
|
23 |
+
"import": "./dist/resolve-uri.mjs"
|
24 |
+
},
|
25 |
+
"./dist/resolve-uri.umd.js"
|
26 |
+
],
|
27 |
+
"./package.json": "./package.json"
|
28 |
+
},
|
29 |
+
"files": [
|
30 |
+
"dist"
|
31 |
+
],
|
32 |
+
"engines": {
|
33 |
+
"node": ">=6.0.0"
|
34 |
+
},
|
35 |
+
"scripts": {
|
36 |
+
"prebuild": "rm -rf dist",
|
37 |
+
"build": "run-s -n build:*",
|
38 |
+
"build:rollup": "rollup -c rollup.config.js",
|
39 |
+
"build:ts": "tsc --project tsconfig.build.json",
|
40 |
+
"lint": "run-s -n lint:*",
|
41 |
+
"lint:prettier": "npm run test:lint:prettier -- --write",
|
42 |
+
"lint:ts": "npm run test:lint:ts -- --fix",
|
43 |
+
"pretest": "run-s build:rollup",
|
44 |
+
"test": "run-s -n test:lint test:only",
|
45 |
+
"test:debug": "mocha --inspect-brk",
|
46 |
+
"test:lint": "run-s -n test:lint:*",
|
47 |
+
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
48 |
+
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
49 |
+
"test:only": "mocha",
|
50 |
+
"test:coverage": "c8 mocha",
|
51 |
+
"test:watch": "mocha --watch",
|
52 |
+
"prepublishOnly": "npm run preversion",
|
53 |
+
"preversion": "run-s test build"
|
54 |
+
},
|
55 |
+
"devDependencies": {
|
56 |
+
"@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*",
|
57 |
+
"@rollup/plugin-typescript": "8.3.0",
|
58 |
+
"@typescript-eslint/eslint-plugin": "5.10.0",
|
59 |
+
"@typescript-eslint/parser": "5.10.0",
|
60 |
+
"c8": "7.11.0",
|
61 |
+
"eslint": "8.7.0",
|
62 |
+
"eslint-config-prettier": "8.3.0",
|
63 |
+
"mocha": "9.2.0",
|
64 |
+
"npm-run-all": "4.1.5",
|
65 |
+
"prettier": "2.5.1",
|
66 |
+
"rollup": "2.66.0",
|
67 |
+
"typescript": "4.5.5"
|
68 |
+
}
|
69 |
+
}
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2015 Rich Harris
|
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
|
13 |
+
all 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
|
21 |
+
THE SOFTWARE.
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/README.md
ADDED
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# @jridgewell/sourcemap-codec
|
2 |
+
|
3 |
+
Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
|
4 |
+
|
5 |
+
|
6 |
+
## Why?
|
7 |
+
|
8 |
+
Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
|
9 |
+
|
10 |
+
This package makes the process slightly easier.
|
11 |
+
|
12 |
+
|
13 |
+
## Installation
|
14 |
+
|
15 |
+
```bash
|
16 |
+
npm install @jridgewell/sourcemap-codec
|
17 |
+
```
|
18 |
+
|
19 |
+
|
20 |
+
## Usage
|
21 |
+
|
22 |
+
```js
|
23 |
+
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
24 |
+
|
25 |
+
var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
26 |
+
|
27 |
+
assert.deepEqual( decoded, [
|
28 |
+
// the first line (of the generated code) has no mappings,
|
29 |
+
// as shown by the starting semi-colon (which separates lines)
|
30 |
+
[],
|
31 |
+
|
32 |
+
// the second line contains four (comma-separated) segments
|
33 |
+
[
|
34 |
+
// segments are encoded as you'd expect:
|
35 |
+
// [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
|
36 |
+
|
37 |
+
// i.e. the first segment begins at column 2, and maps back to the second column
|
38 |
+
// of the second line (both zero-based) of the 0th source, and uses the 0th
|
39 |
+
// name in the `map.names` array
|
40 |
+
[ 2, 0, 2, 2, 0 ],
|
41 |
+
|
42 |
+
// the remaining segments are 4-length rather than 5-length,
|
43 |
+
// because they don't map a name
|
44 |
+
[ 4, 0, 2, 4 ],
|
45 |
+
[ 6, 0, 2, 5 ],
|
46 |
+
[ 7, 0, 2, 7 ]
|
47 |
+
],
|
48 |
+
|
49 |
+
// the final line contains two segments
|
50 |
+
[
|
51 |
+
[ 2, 1, 10, 19 ],
|
52 |
+
[ 12, 1, 11, 20 ]
|
53 |
+
]
|
54 |
+
]);
|
55 |
+
|
56 |
+
var encoded = encode( decoded );
|
57 |
+
assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
58 |
+
```
|
59 |
+
|
60 |
+
## Benchmarks
|
61 |
+
|
62 |
+
```
|
63 |
+
node v20.10.0
|
64 |
+
|
65 |
+
amp.js.map - 45120 segments
|
66 |
+
|
67 |
+
Decode Memory Usage:
|
68 |
+
local code 5815135 bytes
|
69 |
+
@jridgewell/sourcemap-codec 1.4.15 5868160 bytes
|
70 |
+
sourcemap-codec 5492584 bytes
|
71 |
+
source-map-0.6.1 13569984 bytes
|
72 |
+
source-map-0.8.0 6390584 bytes
|
73 |
+
chrome dev tools 8011136 bytes
|
74 |
+
Smallest memory usage is sourcemap-codec
|
75 |
+
|
76 |
+
Decode speed:
|
77 |
+
decode: local code x 492 ops/sec ±1.22% (90 runs sampled)
|
78 |
+
decode: @jridgewell/sourcemap-codec 1.4.15 x 499 ops/sec ±1.16% (89 runs sampled)
|
79 |
+
decode: sourcemap-codec x 376 ops/sec ±1.66% (89 runs sampled)
|
80 |
+
decode: source-map-0.6.1 x 34.99 ops/sec ±0.94% (48 runs sampled)
|
81 |
+
decode: source-map-0.8.0 x 351 ops/sec ±0.07% (95 runs sampled)
|
82 |
+
chrome dev tools x 165 ops/sec ±0.91% (86 runs sampled)
|
83 |
+
Fastest is decode: @jridgewell/sourcemap-codec 1.4.15
|
84 |
+
|
85 |
+
Encode Memory Usage:
|
86 |
+
local code 444248 bytes
|
87 |
+
@jridgewell/sourcemap-codec 1.4.15 623024 bytes
|
88 |
+
sourcemap-codec 8696280 bytes
|
89 |
+
source-map-0.6.1 8745176 bytes
|
90 |
+
source-map-0.8.0 8736624 bytes
|
91 |
+
Smallest memory usage is local code
|
92 |
+
|
93 |
+
Encode speed:
|
94 |
+
encode: local code x 796 ops/sec ±0.11% (97 runs sampled)
|
95 |
+
encode: @jridgewell/sourcemap-codec 1.4.15 x 795 ops/sec ±0.25% (98 runs sampled)
|
96 |
+
encode: sourcemap-codec x 231 ops/sec ±0.83% (86 runs sampled)
|
97 |
+
encode: source-map-0.6.1 x 166 ops/sec ±0.57% (86 runs sampled)
|
98 |
+
encode: source-map-0.8.0 x 203 ops/sec ±0.45% (88 runs sampled)
|
99 |
+
Fastest is encode: local code,encode: @jridgewell/sourcemap-codec 1.4.15
|
100 |
+
|
101 |
+
|
102 |
+
***
|
103 |
+
|
104 |
+
|
105 |
+
babel.min.js.map - 347793 segments
|
106 |
+
|
107 |
+
Decode Memory Usage:
|
108 |
+
local code 35424960 bytes
|
109 |
+
@jridgewell/sourcemap-codec 1.4.15 35424696 bytes
|
110 |
+
sourcemap-codec 36033464 bytes
|
111 |
+
source-map-0.6.1 62253704 bytes
|
112 |
+
source-map-0.8.0 43843920 bytes
|
113 |
+
chrome dev tools 45111400 bytes
|
114 |
+
Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15
|
115 |
+
|
116 |
+
Decode speed:
|
117 |
+
decode: local code x 38.18 ops/sec ±5.44% (52 runs sampled)
|
118 |
+
decode: @jridgewell/sourcemap-codec 1.4.15 x 38.36 ops/sec ±5.02% (52 runs sampled)
|
119 |
+
decode: sourcemap-codec x 34.05 ops/sec ±4.45% (47 runs sampled)
|
120 |
+
decode: source-map-0.6.1 x 4.31 ops/sec ±2.76% (15 runs sampled)
|
121 |
+
decode: source-map-0.8.0 x 55.60 ops/sec ±0.13% (73 runs sampled)
|
122 |
+
chrome dev tools x 16.94 ops/sec ±3.78% (46 runs sampled)
|
123 |
+
Fastest is decode: source-map-0.8.0
|
124 |
+
|
125 |
+
Encode Memory Usage:
|
126 |
+
local code 2606016 bytes
|
127 |
+
@jridgewell/sourcemap-codec 1.4.15 2626440 bytes
|
128 |
+
sourcemap-codec 21152576 bytes
|
129 |
+
source-map-0.6.1 25023928 bytes
|
130 |
+
source-map-0.8.0 25256448 bytes
|
131 |
+
Smallest memory usage is local code
|
132 |
+
|
133 |
+
Encode speed:
|
134 |
+
encode: local code x 127 ops/sec ±0.18% (83 runs sampled)
|
135 |
+
encode: @jridgewell/sourcemap-codec 1.4.15 x 128 ops/sec ±0.26% (83 runs sampled)
|
136 |
+
encode: sourcemap-codec x 29.31 ops/sec ±2.55% (53 runs sampled)
|
137 |
+
encode: source-map-0.6.1 x 18.85 ops/sec ±3.19% (36 runs sampled)
|
138 |
+
encode: source-map-0.8.0 x 19.34 ops/sec ±1.97% (36 runs sampled)
|
139 |
+
Fastest is encode: @jridgewell/sourcemap-codec 1.4.15
|
140 |
+
|
141 |
+
|
142 |
+
***
|
143 |
+
|
144 |
+
|
145 |
+
preact.js.map - 1992 segments
|
146 |
+
|
147 |
+
Decode Memory Usage:
|
148 |
+
local code 261696 bytes
|
149 |
+
@jridgewell/sourcemap-codec 1.4.15 244296 bytes
|
150 |
+
sourcemap-codec 302816 bytes
|
151 |
+
source-map-0.6.1 939176 bytes
|
152 |
+
source-map-0.8.0 336 bytes
|
153 |
+
chrome dev tools 587368 bytes
|
154 |
+
Smallest memory usage is source-map-0.8.0
|
155 |
+
|
156 |
+
Decode speed:
|
157 |
+
decode: local code x 17,782 ops/sec ±0.32% (97 runs sampled)
|
158 |
+
decode: @jridgewell/sourcemap-codec 1.4.15 x 17,863 ops/sec ±0.40% (100 runs sampled)
|
159 |
+
decode: sourcemap-codec x 12,453 ops/sec ±0.27% (101 runs sampled)
|
160 |
+
decode: source-map-0.6.1 x 1,288 ops/sec ±1.05% (96 runs sampled)
|
161 |
+
decode: source-map-0.8.0 x 9,289 ops/sec ±0.27% (101 runs sampled)
|
162 |
+
chrome dev tools x 4,769 ops/sec ±0.18% (100 runs sampled)
|
163 |
+
Fastest is decode: @jridgewell/sourcemap-codec 1.4.15
|
164 |
+
|
165 |
+
Encode Memory Usage:
|
166 |
+
local code 262944 bytes
|
167 |
+
@jridgewell/sourcemap-codec 1.4.15 25544 bytes
|
168 |
+
sourcemap-codec 323048 bytes
|
169 |
+
source-map-0.6.1 507808 bytes
|
170 |
+
source-map-0.8.0 507480 bytes
|
171 |
+
Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15
|
172 |
+
|
173 |
+
Encode speed:
|
174 |
+
encode: local code x 24,207 ops/sec ±0.79% (95 runs sampled)
|
175 |
+
encode: @jridgewell/sourcemap-codec 1.4.15 x 24,288 ops/sec ±0.48% (96 runs sampled)
|
176 |
+
encode: sourcemap-codec x 6,761 ops/sec ±0.21% (100 runs sampled)
|
177 |
+
encode: source-map-0.6.1 x 5,374 ops/sec ±0.17% (99 runs sampled)
|
178 |
+
encode: source-map-0.8.0 x 5,633 ops/sec ±0.32% (99 runs sampled)
|
179 |
+
Fastest is encode: @jridgewell/sourcemap-codec 1.4.15,encode: local code
|
180 |
+
|
181 |
+
|
182 |
+
***
|
183 |
+
|
184 |
+
|
185 |
+
react.js.map - 5726 segments
|
186 |
+
|
187 |
+
Decode Memory Usage:
|
188 |
+
local code 678816 bytes
|
189 |
+
@jridgewell/sourcemap-codec 1.4.15 678816 bytes
|
190 |
+
sourcemap-codec 816400 bytes
|
191 |
+
source-map-0.6.1 2288864 bytes
|
192 |
+
source-map-0.8.0 721360 bytes
|
193 |
+
chrome dev tools 1012512 bytes
|
194 |
+
Smallest memory usage is local code
|
195 |
+
|
196 |
+
Decode speed:
|
197 |
+
decode: local code x 6,178 ops/sec ±0.19% (98 runs sampled)
|
198 |
+
decode: @jridgewell/sourcemap-codec 1.4.15 x 6,261 ops/sec ±0.22% (100 runs sampled)
|
199 |
+
decode: sourcemap-codec x 4,472 ops/sec ±0.90% (99 runs sampled)
|
200 |
+
decode: source-map-0.6.1 x 449 ops/sec ±0.31% (95 runs sampled)
|
201 |
+
decode: source-map-0.8.0 x 3,219 ops/sec ±0.13% (100 runs sampled)
|
202 |
+
chrome dev tools x 1,743 ops/sec ±0.20% (99 runs sampled)
|
203 |
+
Fastest is decode: @jridgewell/sourcemap-codec 1.4.15
|
204 |
+
|
205 |
+
Encode Memory Usage:
|
206 |
+
local code 140960 bytes
|
207 |
+
@jridgewell/sourcemap-codec 1.4.15 159808 bytes
|
208 |
+
sourcemap-codec 969304 bytes
|
209 |
+
source-map-0.6.1 930520 bytes
|
210 |
+
source-map-0.8.0 930248 bytes
|
211 |
+
Smallest memory usage is local code
|
212 |
+
|
213 |
+
Encode speed:
|
214 |
+
encode: local code x 8,013 ops/sec ±0.19% (100 runs sampled)
|
215 |
+
encode: @jridgewell/sourcemap-codec 1.4.15 x 7,989 ops/sec ±0.20% (101 runs sampled)
|
216 |
+
encode: sourcemap-codec x 2,472 ops/sec ±0.21% (99 runs sampled)
|
217 |
+
encode: source-map-0.6.1 x 2,200 ops/sec ±0.17% (99 runs sampled)
|
218 |
+
encode: source-map-0.8.0 x 2,220 ops/sec ±0.37% (99 runs sampled)
|
219 |
+
Fastest is encode: local code
|
220 |
+
|
221 |
+
|
222 |
+
***
|
223 |
+
|
224 |
+
|
225 |
+
vscode.map - 2141001 segments
|
226 |
+
|
227 |
+
Decode Memory Usage:
|
228 |
+
local code 198955264 bytes
|
229 |
+
@jridgewell/sourcemap-codec 1.4.15 199175352 bytes
|
230 |
+
sourcemap-codec 199102688 bytes
|
231 |
+
source-map-0.6.1 386323432 bytes
|
232 |
+
source-map-0.8.0 244116432 bytes
|
233 |
+
chrome dev tools 293734280 bytes
|
234 |
+
Smallest memory usage is local code
|
235 |
+
|
236 |
+
Decode speed:
|
237 |
+
decode: local code x 3.90 ops/sec ±22.21% (15 runs sampled)
|
238 |
+
decode: @jridgewell/sourcemap-codec 1.4.15 x 3.95 ops/sec ±23.53% (15 runs sampled)
|
239 |
+
decode: sourcemap-codec x 3.82 ops/sec ±17.94% (14 runs sampled)
|
240 |
+
decode: source-map-0.6.1 x 0.61 ops/sec ±7.81% (6 runs sampled)
|
241 |
+
decode: source-map-0.8.0 x 9.54 ops/sec ±0.28% (28 runs sampled)
|
242 |
+
chrome dev tools x 2.18 ops/sec ±10.58% (10 runs sampled)
|
243 |
+
Fastest is decode: source-map-0.8.0
|
244 |
+
|
245 |
+
Encode Memory Usage:
|
246 |
+
local code 13509880 bytes
|
247 |
+
@jridgewell/sourcemap-codec 1.4.15 13537648 bytes
|
248 |
+
sourcemap-codec 32540104 bytes
|
249 |
+
source-map-0.6.1 127531040 bytes
|
250 |
+
source-map-0.8.0 127535312 bytes
|
251 |
+
Smallest memory usage is local code
|
252 |
+
|
253 |
+
Encode speed:
|
254 |
+
encode: local code x 20.10 ops/sec ±0.19% (38 runs sampled)
|
255 |
+
encode: @jridgewell/sourcemap-codec 1.4.15 x 20.26 ops/sec ±0.32% (38 runs sampled)
|
256 |
+
encode: sourcemap-codec x 5.44 ops/sec ±1.64% (18 runs sampled)
|
257 |
+
encode: source-map-0.6.1 x 2.30 ops/sec ±4.79% (10 runs sampled)
|
258 |
+
encode: source-map-0.8.0 x 2.46 ops/sec ±6.53% (10 runs sampled)
|
259 |
+
Fastest is encode: @jridgewell/sourcemap-codec 1.4.15
|
260 |
+
```
|
261 |
+
|
262 |
+
# License
|
263 |
+
|
264 |
+
MIT
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
ADDED
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const comma = ','.charCodeAt(0);
|
2 |
+
const semicolon = ';'.charCodeAt(0);
|
3 |
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
4 |
+
const intToChar = new Uint8Array(64); // 64 possible chars.
|
5 |
+
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
6 |
+
for (let i = 0; i < chars.length; i++) {
|
7 |
+
const c = chars.charCodeAt(i);
|
8 |
+
intToChar[i] = c;
|
9 |
+
charToInt[c] = i;
|
10 |
+
}
|
11 |
+
function decodeInteger(reader, relative) {
|
12 |
+
let value = 0;
|
13 |
+
let shift = 0;
|
14 |
+
let integer = 0;
|
15 |
+
do {
|
16 |
+
const c = reader.next();
|
17 |
+
integer = charToInt[c];
|
18 |
+
value |= (integer & 31) << shift;
|
19 |
+
shift += 5;
|
20 |
+
} while (integer & 32);
|
21 |
+
const shouldNegate = value & 1;
|
22 |
+
value >>>= 1;
|
23 |
+
if (shouldNegate) {
|
24 |
+
value = -0x80000000 | -value;
|
25 |
+
}
|
26 |
+
return relative + value;
|
27 |
+
}
|
28 |
+
function encodeInteger(builder, num, relative) {
|
29 |
+
let delta = num - relative;
|
30 |
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
31 |
+
do {
|
32 |
+
let clamped = delta & 0b011111;
|
33 |
+
delta >>>= 5;
|
34 |
+
if (delta > 0)
|
35 |
+
clamped |= 0b100000;
|
36 |
+
builder.write(intToChar[clamped]);
|
37 |
+
} while (delta > 0);
|
38 |
+
return num;
|
39 |
+
}
|
40 |
+
function hasMoreVlq(reader, max) {
|
41 |
+
if (reader.pos >= max)
|
42 |
+
return false;
|
43 |
+
return reader.peek() !== comma;
|
44 |
+
}
|
45 |
+
|
46 |
+
const bufLength = 1024 * 16;
|
47 |
+
// Provide a fallback for older environments.
|
48 |
+
const td = typeof TextDecoder !== 'undefined'
|
49 |
+
? /* #__PURE__ */ new TextDecoder()
|
50 |
+
: typeof Buffer !== 'undefined'
|
51 |
+
? {
|
52 |
+
decode(buf) {
|
53 |
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
54 |
+
return out.toString();
|
55 |
+
},
|
56 |
+
}
|
57 |
+
: {
|
58 |
+
decode(buf) {
|
59 |
+
let out = '';
|
60 |
+
for (let i = 0; i < buf.length; i++) {
|
61 |
+
out += String.fromCharCode(buf[i]);
|
62 |
+
}
|
63 |
+
return out;
|
64 |
+
},
|
65 |
+
};
|
66 |
+
class StringWriter {
|
67 |
+
constructor() {
|
68 |
+
this.pos = 0;
|
69 |
+
this.out = '';
|
70 |
+
this.buffer = new Uint8Array(bufLength);
|
71 |
+
}
|
72 |
+
write(v) {
|
73 |
+
const { buffer } = this;
|
74 |
+
buffer[this.pos++] = v;
|
75 |
+
if (this.pos === bufLength) {
|
76 |
+
this.out += td.decode(buffer);
|
77 |
+
this.pos = 0;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
flush() {
|
81 |
+
const { buffer, out, pos } = this;
|
82 |
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
class StringReader {
|
86 |
+
constructor(buffer) {
|
87 |
+
this.pos = 0;
|
88 |
+
this.buffer = buffer;
|
89 |
+
}
|
90 |
+
next() {
|
91 |
+
return this.buffer.charCodeAt(this.pos++);
|
92 |
+
}
|
93 |
+
peek() {
|
94 |
+
return this.buffer.charCodeAt(this.pos);
|
95 |
+
}
|
96 |
+
indexOf(char) {
|
97 |
+
const { buffer, pos } = this;
|
98 |
+
const idx = buffer.indexOf(char, pos);
|
99 |
+
return idx === -1 ? buffer.length : idx;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
const EMPTY = [];
|
104 |
+
function decodeOriginalScopes(input) {
|
105 |
+
const { length } = input;
|
106 |
+
const reader = new StringReader(input);
|
107 |
+
const scopes = [];
|
108 |
+
const stack = [];
|
109 |
+
let line = 0;
|
110 |
+
for (; reader.pos < length; reader.pos++) {
|
111 |
+
line = decodeInteger(reader, line);
|
112 |
+
const column = decodeInteger(reader, 0);
|
113 |
+
if (!hasMoreVlq(reader, length)) {
|
114 |
+
const last = stack.pop();
|
115 |
+
last[2] = line;
|
116 |
+
last[3] = column;
|
117 |
+
continue;
|
118 |
+
}
|
119 |
+
const kind = decodeInteger(reader, 0);
|
120 |
+
const fields = decodeInteger(reader, 0);
|
121 |
+
const hasName = fields & 0b0001;
|
122 |
+
const scope = (hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]);
|
123 |
+
let vars = EMPTY;
|
124 |
+
if (hasMoreVlq(reader, length)) {
|
125 |
+
vars = [];
|
126 |
+
do {
|
127 |
+
const varsIndex = decodeInteger(reader, 0);
|
128 |
+
vars.push(varsIndex);
|
129 |
+
} while (hasMoreVlq(reader, length));
|
130 |
+
}
|
131 |
+
scope.vars = vars;
|
132 |
+
scopes.push(scope);
|
133 |
+
stack.push(scope);
|
134 |
+
}
|
135 |
+
return scopes;
|
136 |
+
}
|
137 |
+
function encodeOriginalScopes(scopes) {
|
138 |
+
const writer = new StringWriter();
|
139 |
+
for (let i = 0; i < scopes.length;) {
|
140 |
+
i = _encodeOriginalScopes(scopes, i, writer, [0]);
|
141 |
+
}
|
142 |
+
return writer.flush();
|
143 |
+
}
|
144 |
+
function _encodeOriginalScopes(scopes, index, writer, state) {
|
145 |
+
const scope = scopes[index];
|
146 |
+
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
|
147 |
+
if (index > 0)
|
148 |
+
writer.write(comma);
|
149 |
+
state[0] = encodeInteger(writer, startLine, state[0]);
|
150 |
+
encodeInteger(writer, startColumn, 0);
|
151 |
+
encodeInteger(writer, kind, 0);
|
152 |
+
const fields = scope.length === 6 ? 0b0001 : 0;
|
153 |
+
encodeInteger(writer, fields, 0);
|
154 |
+
if (scope.length === 6)
|
155 |
+
encodeInteger(writer, scope[5], 0);
|
156 |
+
for (const v of vars) {
|
157 |
+
encodeInteger(writer, v, 0);
|
158 |
+
}
|
159 |
+
for (index++; index < scopes.length;) {
|
160 |
+
const next = scopes[index];
|
161 |
+
const { 0: l, 1: c } = next;
|
162 |
+
if (l > endLine || (l === endLine && c >= endColumn)) {
|
163 |
+
break;
|
164 |
+
}
|
165 |
+
index = _encodeOriginalScopes(scopes, index, writer, state);
|
166 |
+
}
|
167 |
+
writer.write(comma);
|
168 |
+
state[0] = encodeInteger(writer, endLine, state[0]);
|
169 |
+
encodeInteger(writer, endColumn, 0);
|
170 |
+
return index;
|
171 |
+
}
|
172 |
+
function decodeGeneratedRanges(input) {
|
173 |
+
const { length } = input;
|
174 |
+
const reader = new StringReader(input);
|
175 |
+
const ranges = [];
|
176 |
+
const stack = [];
|
177 |
+
let genLine = 0;
|
178 |
+
let definitionSourcesIndex = 0;
|
179 |
+
let definitionScopeIndex = 0;
|
180 |
+
let callsiteSourcesIndex = 0;
|
181 |
+
let callsiteLine = 0;
|
182 |
+
let callsiteColumn = 0;
|
183 |
+
let bindingLine = 0;
|
184 |
+
let bindingColumn = 0;
|
185 |
+
do {
|
186 |
+
const semi = reader.indexOf(';');
|
187 |
+
let genColumn = 0;
|
188 |
+
for (; reader.pos < semi; reader.pos++) {
|
189 |
+
genColumn = decodeInteger(reader, genColumn);
|
190 |
+
if (!hasMoreVlq(reader, semi)) {
|
191 |
+
const last = stack.pop();
|
192 |
+
last[2] = genLine;
|
193 |
+
last[3] = genColumn;
|
194 |
+
continue;
|
195 |
+
}
|
196 |
+
const fields = decodeInteger(reader, 0);
|
197 |
+
const hasDefinition = fields & 0b0001;
|
198 |
+
const hasCallsite = fields & 0b0010;
|
199 |
+
const hasScope = fields & 0b0100;
|
200 |
+
let callsite = null;
|
201 |
+
let bindings = EMPTY;
|
202 |
+
let range;
|
203 |
+
if (hasDefinition) {
|
204 |
+
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
|
205 |
+
definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
|
206 |
+
definitionSourcesIndex = defSourcesIndex;
|
207 |
+
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
|
208 |
+
}
|
209 |
+
else {
|
210 |
+
range = [genLine, genColumn, 0, 0];
|
211 |
+
}
|
212 |
+
range.isScope = !!hasScope;
|
213 |
+
if (hasCallsite) {
|
214 |
+
const prevCsi = callsiteSourcesIndex;
|
215 |
+
const prevLine = callsiteLine;
|
216 |
+
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
|
217 |
+
const sameSource = prevCsi === callsiteSourcesIndex;
|
218 |
+
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
|
219 |
+
callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
|
220 |
+
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
|
221 |
+
}
|
222 |
+
range.callsite = callsite;
|
223 |
+
if (hasMoreVlq(reader, semi)) {
|
224 |
+
bindings = [];
|
225 |
+
do {
|
226 |
+
bindingLine = genLine;
|
227 |
+
bindingColumn = genColumn;
|
228 |
+
const expressionsCount = decodeInteger(reader, 0);
|
229 |
+
let expressionRanges;
|
230 |
+
if (expressionsCount < -1) {
|
231 |
+
expressionRanges = [[decodeInteger(reader, 0)]];
|
232 |
+
for (let i = -1; i > expressionsCount; i--) {
|
233 |
+
const prevBl = bindingLine;
|
234 |
+
bindingLine = decodeInteger(reader, bindingLine);
|
235 |
+
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
|
236 |
+
const expression = decodeInteger(reader, 0);
|
237 |
+
expressionRanges.push([expression, bindingLine, bindingColumn]);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
expressionRanges = [[expressionsCount]];
|
242 |
+
}
|
243 |
+
bindings.push(expressionRanges);
|
244 |
+
} while (hasMoreVlq(reader, semi));
|
245 |
+
}
|
246 |
+
range.bindings = bindings;
|
247 |
+
ranges.push(range);
|
248 |
+
stack.push(range);
|
249 |
+
}
|
250 |
+
genLine++;
|
251 |
+
reader.pos = semi + 1;
|
252 |
+
} while (reader.pos < length);
|
253 |
+
return ranges;
|
254 |
+
}
|
255 |
+
function encodeGeneratedRanges(ranges) {
|
256 |
+
if (ranges.length === 0)
|
257 |
+
return '';
|
258 |
+
const writer = new StringWriter();
|
259 |
+
for (let i = 0; i < ranges.length;) {
|
260 |
+
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
|
261 |
+
}
|
262 |
+
return writer.flush();
|
263 |
+
}
|
264 |
+
function _encodeGeneratedRanges(ranges, index, writer, state) {
|
265 |
+
const range = ranges[index];
|
266 |
+
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings, } = range;
|
267 |
+
if (state[0] < startLine) {
|
268 |
+
catchupLine(writer, state[0], startLine);
|
269 |
+
state[0] = startLine;
|
270 |
+
state[1] = 0;
|
271 |
+
}
|
272 |
+
else if (index > 0) {
|
273 |
+
writer.write(comma);
|
274 |
+
}
|
275 |
+
state[1] = encodeInteger(writer, range[1], state[1]);
|
276 |
+
const fields = (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);
|
277 |
+
encodeInteger(writer, fields, 0);
|
278 |
+
if (range.length === 6) {
|
279 |
+
const { 4: sourcesIndex, 5: scopesIndex } = range;
|
280 |
+
if (sourcesIndex !== state[2]) {
|
281 |
+
state[3] = 0;
|
282 |
+
}
|
283 |
+
state[2] = encodeInteger(writer, sourcesIndex, state[2]);
|
284 |
+
state[3] = encodeInteger(writer, scopesIndex, state[3]);
|
285 |
+
}
|
286 |
+
if (callsite) {
|
287 |
+
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
|
288 |
+
if (sourcesIndex !== state[4]) {
|
289 |
+
state[5] = 0;
|
290 |
+
state[6] = 0;
|
291 |
+
}
|
292 |
+
else if (callLine !== state[5]) {
|
293 |
+
state[6] = 0;
|
294 |
+
}
|
295 |
+
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
|
296 |
+
state[5] = encodeInteger(writer, callLine, state[5]);
|
297 |
+
state[6] = encodeInteger(writer, callColumn, state[6]);
|
298 |
+
}
|
299 |
+
if (bindings) {
|
300 |
+
for (const binding of bindings) {
|
301 |
+
if (binding.length > 1)
|
302 |
+
encodeInteger(writer, -binding.length, 0);
|
303 |
+
const expression = binding[0][0];
|
304 |
+
encodeInteger(writer, expression, 0);
|
305 |
+
let bindingStartLine = startLine;
|
306 |
+
let bindingStartColumn = startColumn;
|
307 |
+
for (let i = 1; i < binding.length; i++) {
|
308 |
+
const expRange = binding[i];
|
309 |
+
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
|
310 |
+
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
|
311 |
+
encodeInteger(writer, expRange[0], 0);
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
for (index++; index < ranges.length;) {
|
316 |
+
const next = ranges[index];
|
317 |
+
const { 0: l, 1: c } = next;
|
318 |
+
if (l > endLine || (l === endLine && c >= endColumn)) {
|
319 |
+
break;
|
320 |
+
}
|
321 |
+
index = _encodeGeneratedRanges(ranges, index, writer, state);
|
322 |
+
}
|
323 |
+
if (state[0] < endLine) {
|
324 |
+
catchupLine(writer, state[0], endLine);
|
325 |
+
state[0] = endLine;
|
326 |
+
state[1] = 0;
|
327 |
+
}
|
328 |
+
else {
|
329 |
+
writer.write(comma);
|
330 |
+
}
|
331 |
+
state[1] = encodeInteger(writer, endColumn, state[1]);
|
332 |
+
return index;
|
333 |
+
}
|
334 |
+
function catchupLine(writer, lastLine, line) {
|
335 |
+
do {
|
336 |
+
writer.write(semicolon);
|
337 |
+
} while (++lastLine < line);
|
338 |
+
}
|
339 |
+
|
340 |
+
function decode(mappings) {
|
341 |
+
const { length } = mappings;
|
342 |
+
const reader = new StringReader(mappings);
|
343 |
+
const decoded = [];
|
344 |
+
let genColumn = 0;
|
345 |
+
let sourcesIndex = 0;
|
346 |
+
let sourceLine = 0;
|
347 |
+
let sourceColumn = 0;
|
348 |
+
let namesIndex = 0;
|
349 |
+
do {
|
350 |
+
const semi = reader.indexOf(';');
|
351 |
+
const line = [];
|
352 |
+
let sorted = true;
|
353 |
+
let lastCol = 0;
|
354 |
+
genColumn = 0;
|
355 |
+
while (reader.pos < semi) {
|
356 |
+
let seg;
|
357 |
+
genColumn = decodeInteger(reader, genColumn);
|
358 |
+
if (genColumn < lastCol)
|
359 |
+
sorted = false;
|
360 |
+
lastCol = genColumn;
|
361 |
+
if (hasMoreVlq(reader, semi)) {
|
362 |
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
363 |
+
sourceLine = decodeInteger(reader, sourceLine);
|
364 |
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
365 |
+
if (hasMoreVlq(reader, semi)) {
|
366 |
+
namesIndex = decodeInteger(reader, namesIndex);
|
367 |
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
368 |
+
}
|
369 |
+
else {
|
370 |
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
371 |
+
}
|
372 |
+
}
|
373 |
+
else {
|
374 |
+
seg = [genColumn];
|
375 |
+
}
|
376 |
+
line.push(seg);
|
377 |
+
reader.pos++;
|
378 |
+
}
|
379 |
+
if (!sorted)
|
380 |
+
sort(line);
|
381 |
+
decoded.push(line);
|
382 |
+
reader.pos = semi + 1;
|
383 |
+
} while (reader.pos <= length);
|
384 |
+
return decoded;
|
385 |
+
}
|
386 |
+
function sort(line) {
|
387 |
+
line.sort(sortComparator);
|
388 |
+
}
|
389 |
+
function sortComparator(a, b) {
|
390 |
+
return a[0] - b[0];
|
391 |
+
}
|
392 |
+
function encode(decoded) {
|
393 |
+
const writer = new StringWriter();
|
394 |
+
let sourcesIndex = 0;
|
395 |
+
let sourceLine = 0;
|
396 |
+
let sourceColumn = 0;
|
397 |
+
let namesIndex = 0;
|
398 |
+
for (let i = 0; i < decoded.length; i++) {
|
399 |
+
const line = decoded[i];
|
400 |
+
if (i > 0)
|
401 |
+
writer.write(semicolon);
|
402 |
+
if (line.length === 0)
|
403 |
+
continue;
|
404 |
+
let genColumn = 0;
|
405 |
+
for (let j = 0; j < line.length; j++) {
|
406 |
+
const segment = line[j];
|
407 |
+
if (j > 0)
|
408 |
+
writer.write(comma);
|
409 |
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
410 |
+
if (segment.length === 1)
|
411 |
+
continue;
|
412 |
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
413 |
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
414 |
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
415 |
+
if (segment.length === 4)
|
416 |
+
continue;
|
417 |
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
418 |
+
}
|
419 |
+
}
|
420 |
+
return writer.flush();
|
421 |
+
}
|
422 |
+
|
423 |
+
export { decode, decodeGeneratedRanges, decodeOriginalScopes, encode, encodeGeneratedRanges, encodeOriginalScopes };
|
424 |
+
//# sourceMappingURL=sourcemap-codec.mjs.map
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"sourcemap-codec.mjs","sources":["../src/vlq.ts","../src/strings.ts","../src/scopes.ts","../src/sourcemap-codec.ts"],"sourcesContent":["import type { StringReader, StringWriter } from './strings';\n\nexport const comma = ','.charCodeAt(0);\nexport const semicolon = ';'.charCodeAt(0);\n\nconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst intToChar = new Uint8Array(64); // 64 possible chars.\nconst charToInt = new Uint8Array(128); // z is 122 in ASCII\n\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\n\nexport function decodeInteger(reader: StringReader, relative: number): number {\n let value = 0;\n let shift = 0;\n let integer = 0;\n\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n\n const shouldNegate = value & 1;\n value >>>= 1;\n\n if (shouldNegate) {\n value = -0x80000000 | -value;\n }\n\n return relative + value;\n}\n\nexport function encodeInteger(builder: StringWriter, num: number, relative: number): number {\n let delta = num - relative;\n\n delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;\n do {\n let clamped = delta & 0b011111;\n delta >>>= 5;\n if (delta > 0) clamped |= 0b100000;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n\n return num;\n}\n\nexport function hasMoreVlq(reader: StringReader, max: number) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n","const bufLength = 1024 * 16;\n\n// Provide a fallback for older environments.\nconst td =\n typeof TextDecoder !== 'undefined'\n ? /* #__PURE__ */ new TextDecoder()\n : typeof Buffer !== 'undefined'\n ? {\n decode(buf: Uint8Array): string {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n },\n }\n : {\n decode(buf: Uint8Array): string {\n let out = '';\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n },\n };\n\nexport class StringWriter {\n pos = 0;\n private out = '';\n private buffer = new Uint8Array(bufLength);\n\n write(v: number): void {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n\n flush(): string {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n}\n\nexport class StringReader {\n pos = 0;\n private declare buffer: string;\n\n constructor(buffer: string) {\n this.buffer = buffer;\n }\n\n next(): number {\n return this.buffer.charCodeAt(this.pos++);\n }\n\n peek(): number {\n return this.buffer.charCodeAt(this.pos);\n }\n\n indexOf(char: string): number {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n}\n","import { StringReader, StringWriter } from './strings';\nimport { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\n\nconst EMPTY: any[] = [];\n\ntype Line = number;\ntype Column = number;\ntype Kind = number;\ntype Name = number;\ntype Var = number;\ntype SourcesIndex = number;\ntype ScopesIndex = number;\n\ntype Mix<A, B, O> = (A & O) | (B & O);\n\nexport type OriginalScope = Mix<\n [Line, Column, Line, Column, Kind],\n [Line, Column, Line, Column, Kind, Name],\n { vars: Var[] }\n>;\n\nexport type GeneratedRange = Mix<\n [Line, Column, Line, Column],\n [Line, Column, Line, Column, SourcesIndex, ScopesIndex],\n {\n callsite: CallSite | null;\n bindings: Binding[];\n isScope: boolean;\n }\n>;\nexport type CallSite = [SourcesIndex, Line, Column];\ntype Binding = BindingExpressionRange[];\nexport type BindingExpressionRange = [Name] | [Name, Line, Column];\n\nexport function decodeOriginalScopes(input: string): OriginalScope[] {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes: OriginalScope[] = [];\n const stack: OriginalScope[] = [];\n let line = 0;\n\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop()!;\n last[2] = line;\n last[3] = column;\n continue;\n }\n\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 0b0001;\n\n const scope: OriginalScope = (\n hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]\n ) as OriginalScope;\n\n let vars: Var[] = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n\n scopes.push(scope);\n stack.push(scope);\n }\n\n return scopes;\n}\n\nexport function encodeOriginalScopes(scopes: OriginalScope[]): string {\n const writer = new StringWriter();\n\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeOriginalScopes(\n scopes: OriginalScope[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenColumn\n ],\n): number {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n\n if (index > 0) writer.write(comma);\n\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n\n const fields = scope.length === 6 ? 0b0001 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n\n return index;\n}\n\nexport function decodeGeneratedRanges(input: string): GeneratedRange[] {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges: GeneratedRange[] = [];\n const stack: GeneratedRange[] = [];\n\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n\n do {\n const semi = reader.indexOf(';');\n let genColumn = 0;\n\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop()!;\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 0b0001;\n const hasCallsite = fields & 0b0010;\n const hasScope = fields & 0b0100;\n\n let callsite: CallSite | null = null;\n let bindings: Binding[] = EMPTY;\n let range: GeneratedRange;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0,\n );\n\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange;\n } else {\n range = [genLine, genColumn, 0, 0] as GeneratedRange;\n }\n\n range.isScope = !!hasScope;\n\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0,\n );\n\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges: BindingExpressionRange[];\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n\n ranges.push(range);\n stack.push(range);\n }\n\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n\n return ranges;\n}\n\nexport function encodeGeneratedRanges(ranges: GeneratedRange[]): string {\n if (ranges.length === 0) return '';\n\n const writer = new StringWriter();\n\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeGeneratedRanges(\n ranges: GeneratedRange[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenLine\n number, // GenColumn\n number, // DefSourcesIndex\n number, // DefScopesIndex\n number, // CallSourcesIndex\n number, // CallLine\n number, // CallColumn\n ],\n): number {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings,\n } = range;\n\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n\n state[1] = encodeInteger(writer, range[1], state[1]);\n\n const fields =\n (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);\n encodeInteger(writer, fields, 0);\n\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn);\n encodeInteger(writer, expRange[0]!, 0);\n }\n }\n }\n\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n\n return index;\n}\n\nfunction catchupLine(writer: StringWriter, lastLine: number, line: number) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n","import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\nimport { StringWriter, StringReader } from './strings';\n\nexport {\n decodeOriginalScopes,\n encodeOriginalScopes,\n decodeGeneratedRanges,\n encodeGeneratedRanges,\n} from './scopes';\nexport type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';\n\nexport type SourceMapSegment =\n | [number]\n | [number, number, number, number]\n | [number, number, number, number, number];\nexport type SourceMapLine = SourceMapSegment[];\nexport type SourceMapMappings = SourceMapLine[];\n\nexport function decode(mappings: string): SourceMapMappings {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded: SourceMapMappings = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n do {\n const semi = reader.indexOf(';');\n const line: SourceMapLine = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n\n while (reader.pos < semi) {\n let seg: SourceMapSegment;\n\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n\n line.push(seg);\n reader.pos++;\n }\n\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n\n return decoded;\n}\n\nfunction sort(line: SourceMapSegment[]) {\n line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[0] - b[0];\n}\n\nexport function encode(decoded: SourceMapMappings): string;\nexport function encode(decoded: Readonly<SourceMapMappings>): string;\nexport function encode(decoded: Readonly<SourceMapMappings>): string {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n\n let genColumn = 0;\n\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n\n genColumn = encodeInteger(writer, segment[0], genColumn);\n\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n\n return writer.flush();\n}\n"],"names":[],"mappings":"AAEO,MAAM,KAAK,GAAG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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (global, factory) {
|
2 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3 |
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4 |
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {}));
|
5 |
+
})(this, (function (exports) { 'use strict';
|
6 |
+
|
7 |
+
const comma = ','.charCodeAt(0);
|
8 |
+
const semicolon = ';'.charCodeAt(0);
|
9 |
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
10 |
+
const intToChar = new Uint8Array(64); // 64 possible chars.
|
11 |
+
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
12 |
+
for (let i = 0; i < chars.length; i++) {
|
13 |
+
const c = chars.charCodeAt(i);
|
14 |
+
intToChar[i] = c;
|
15 |
+
charToInt[c] = i;
|
16 |
+
}
|
17 |
+
function decodeInteger(reader, relative) {
|
18 |
+
let value = 0;
|
19 |
+
let shift = 0;
|
20 |
+
let integer = 0;
|
21 |
+
do {
|
22 |
+
const c = reader.next();
|
23 |
+
integer = charToInt[c];
|
24 |
+
value |= (integer & 31) << shift;
|
25 |
+
shift += 5;
|
26 |
+
} while (integer & 32);
|
27 |
+
const shouldNegate = value & 1;
|
28 |
+
value >>>= 1;
|
29 |
+
if (shouldNegate) {
|
30 |
+
value = -0x80000000 | -value;
|
31 |
+
}
|
32 |
+
return relative + value;
|
33 |
+
}
|
34 |
+
function encodeInteger(builder, num, relative) {
|
35 |
+
let delta = num - relative;
|
36 |
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
37 |
+
do {
|
38 |
+
let clamped = delta & 0b011111;
|
39 |
+
delta >>>= 5;
|
40 |
+
if (delta > 0)
|
41 |
+
clamped |= 0b100000;
|
42 |
+
builder.write(intToChar[clamped]);
|
43 |
+
} while (delta > 0);
|
44 |
+
return num;
|
45 |
+
}
|
46 |
+
function hasMoreVlq(reader, max) {
|
47 |
+
if (reader.pos >= max)
|
48 |
+
return false;
|
49 |
+
return reader.peek() !== comma;
|
50 |
+
}
|
51 |
+
|
52 |
+
const bufLength = 1024 * 16;
|
53 |
+
// Provide a fallback for older environments.
|
54 |
+
const td = typeof TextDecoder !== 'undefined'
|
55 |
+
? /* #__PURE__ */ new TextDecoder()
|
56 |
+
: typeof Buffer !== 'undefined'
|
57 |
+
? {
|
58 |
+
decode(buf) {
|
59 |
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
60 |
+
return out.toString();
|
61 |
+
},
|
62 |
+
}
|
63 |
+
: {
|
64 |
+
decode(buf) {
|
65 |
+
let out = '';
|
66 |
+
for (let i = 0; i < buf.length; i++) {
|
67 |
+
out += String.fromCharCode(buf[i]);
|
68 |
+
}
|
69 |
+
return out;
|
70 |
+
},
|
71 |
+
};
|
72 |
+
class StringWriter {
|
73 |
+
constructor() {
|
74 |
+
this.pos = 0;
|
75 |
+
this.out = '';
|
76 |
+
this.buffer = new Uint8Array(bufLength);
|
77 |
+
}
|
78 |
+
write(v) {
|
79 |
+
const { buffer } = this;
|
80 |
+
buffer[this.pos++] = v;
|
81 |
+
if (this.pos === bufLength) {
|
82 |
+
this.out += td.decode(buffer);
|
83 |
+
this.pos = 0;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
flush() {
|
87 |
+
const { buffer, out, pos } = this;
|
88 |
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
class StringReader {
|
92 |
+
constructor(buffer) {
|
93 |
+
this.pos = 0;
|
94 |
+
this.buffer = buffer;
|
95 |
+
}
|
96 |
+
next() {
|
97 |
+
return this.buffer.charCodeAt(this.pos++);
|
98 |
+
}
|
99 |
+
peek() {
|
100 |
+
return this.buffer.charCodeAt(this.pos);
|
101 |
+
}
|
102 |
+
indexOf(char) {
|
103 |
+
const { buffer, pos } = this;
|
104 |
+
const idx = buffer.indexOf(char, pos);
|
105 |
+
return idx === -1 ? buffer.length : idx;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
const EMPTY = [];
|
110 |
+
function decodeOriginalScopes(input) {
|
111 |
+
const { length } = input;
|
112 |
+
const reader = new StringReader(input);
|
113 |
+
const scopes = [];
|
114 |
+
const stack = [];
|
115 |
+
let line = 0;
|
116 |
+
for (; reader.pos < length; reader.pos++) {
|
117 |
+
line = decodeInteger(reader, line);
|
118 |
+
const column = decodeInteger(reader, 0);
|
119 |
+
if (!hasMoreVlq(reader, length)) {
|
120 |
+
const last = stack.pop();
|
121 |
+
last[2] = line;
|
122 |
+
last[3] = column;
|
123 |
+
continue;
|
124 |
+
}
|
125 |
+
const kind = decodeInteger(reader, 0);
|
126 |
+
const fields = decodeInteger(reader, 0);
|
127 |
+
const hasName = fields & 0b0001;
|
128 |
+
const scope = (hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]);
|
129 |
+
let vars = EMPTY;
|
130 |
+
if (hasMoreVlq(reader, length)) {
|
131 |
+
vars = [];
|
132 |
+
do {
|
133 |
+
const varsIndex = decodeInteger(reader, 0);
|
134 |
+
vars.push(varsIndex);
|
135 |
+
} while (hasMoreVlq(reader, length));
|
136 |
+
}
|
137 |
+
scope.vars = vars;
|
138 |
+
scopes.push(scope);
|
139 |
+
stack.push(scope);
|
140 |
+
}
|
141 |
+
return scopes;
|
142 |
+
}
|
143 |
+
function encodeOriginalScopes(scopes) {
|
144 |
+
const writer = new StringWriter();
|
145 |
+
for (let i = 0; i < scopes.length;) {
|
146 |
+
i = _encodeOriginalScopes(scopes, i, writer, [0]);
|
147 |
+
}
|
148 |
+
return writer.flush();
|
149 |
+
}
|
150 |
+
function _encodeOriginalScopes(scopes, index, writer, state) {
|
151 |
+
const scope = scopes[index];
|
152 |
+
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
|
153 |
+
if (index > 0)
|
154 |
+
writer.write(comma);
|
155 |
+
state[0] = encodeInteger(writer, startLine, state[0]);
|
156 |
+
encodeInteger(writer, startColumn, 0);
|
157 |
+
encodeInteger(writer, kind, 0);
|
158 |
+
const fields = scope.length === 6 ? 0b0001 : 0;
|
159 |
+
encodeInteger(writer, fields, 0);
|
160 |
+
if (scope.length === 6)
|
161 |
+
encodeInteger(writer, scope[5], 0);
|
162 |
+
for (const v of vars) {
|
163 |
+
encodeInteger(writer, v, 0);
|
164 |
+
}
|
165 |
+
for (index++; index < scopes.length;) {
|
166 |
+
const next = scopes[index];
|
167 |
+
const { 0: l, 1: c } = next;
|
168 |
+
if (l > endLine || (l === endLine && c >= endColumn)) {
|
169 |
+
break;
|
170 |
+
}
|
171 |
+
index = _encodeOriginalScopes(scopes, index, writer, state);
|
172 |
+
}
|
173 |
+
writer.write(comma);
|
174 |
+
state[0] = encodeInteger(writer, endLine, state[0]);
|
175 |
+
encodeInteger(writer, endColumn, 0);
|
176 |
+
return index;
|
177 |
+
}
|
178 |
+
function decodeGeneratedRanges(input) {
|
179 |
+
const { length } = input;
|
180 |
+
const reader = new StringReader(input);
|
181 |
+
const ranges = [];
|
182 |
+
const stack = [];
|
183 |
+
let genLine = 0;
|
184 |
+
let definitionSourcesIndex = 0;
|
185 |
+
let definitionScopeIndex = 0;
|
186 |
+
let callsiteSourcesIndex = 0;
|
187 |
+
let callsiteLine = 0;
|
188 |
+
let callsiteColumn = 0;
|
189 |
+
let bindingLine = 0;
|
190 |
+
let bindingColumn = 0;
|
191 |
+
do {
|
192 |
+
const semi = reader.indexOf(';');
|
193 |
+
let genColumn = 0;
|
194 |
+
for (; reader.pos < semi; reader.pos++) {
|
195 |
+
genColumn = decodeInteger(reader, genColumn);
|
196 |
+
if (!hasMoreVlq(reader, semi)) {
|
197 |
+
const last = stack.pop();
|
198 |
+
last[2] = genLine;
|
199 |
+
last[3] = genColumn;
|
200 |
+
continue;
|
201 |
+
}
|
202 |
+
const fields = decodeInteger(reader, 0);
|
203 |
+
const hasDefinition = fields & 0b0001;
|
204 |
+
const hasCallsite = fields & 0b0010;
|
205 |
+
const hasScope = fields & 0b0100;
|
206 |
+
let callsite = null;
|
207 |
+
let bindings = EMPTY;
|
208 |
+
let range;
|
209 |
+
if (hasDefinition) {
|
210 |
+
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
|
211 |
+
definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
|
212 |
+
definitionSourcesIndex = defSourcesIndex;
|
213 |
+
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
|
214 |
+
}
|
215 |
+
else {
|
216 |
+
range = [genLine, genColumn, 0, 0];
|
217 |
+
}
|
218 |
+
range.isScope = !!hasScope;
|
219 |
+
if (hasCallsite) {
|
220 |
+
const prevCsi = callsiteSourcesIndex;
|
221 |
+
const prevLine = callsiteLine;
|
222 |
+
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
|
223 |
+
const sameSource = prevCsi === callsiteSourcesIndex;
|
224 |
+
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
|
225 |
+
callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
|
226 |
+
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
|
227 |
+
}
|
228 |
+
range.callsite = callsite;
|
229 |
+
if (hasMoreVlq(reader, semi)) {
|
230 |
+
bindings = [];
|
231 |
+
do {
|
232 |
+
bindingLine = genLine;
|
233 |
+
bindingColumn = genColumn;
|
234 |
+
const expressionsCount = decodeInteger(reader, 0);
|
235 |
+
let expressionRanges;
|
236 |
+
if (expressionsCount < -1) {
|
237 |
+
expressionRanges = [[decodeInteger(reader, 0)]];
|
238 |
+
for (let i = -1; i > expressionsCount; i--) {
|
239 |
+
const prevBl = bindingLine;
|
240 |
+
bindingLine = decodeInteger(reader, bindingLine);
|
241 |
+
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
|
242 |
+
const expression = decodeInteger(reader, 0);
|
243 |
+
expressionRanges.push([expression, bindingLine, bindingColumn]);
|
244 |
+
}
|
245 |
+
}
|
246 |
+
else {
|
247 |
+
expressionRanges = [[expressionsCount]];
|
248 |
+
}
|
249 |
+
bindings.push(expressionRanges);
|
250 |
+
} while (hasMoreVlq(reader, semi));
|
251 |
+
}
|
252 |
+
range.bindings = bindings;
|
253 |
+
ranges.push(range);
|
254 |
+
stack.push(range);
|
255 |
+
}
|
256 |
+
genLine++;
|
257 |
+
reader.pos = semi + 1;
|
258 |
+
} while (reader.pos < length);
|
259 |
+
return ranges;
|
260 |
+
}
|
261 |
+
function encodeGeneratedRanges(ranges) {
|
262 |
+
if (ranges.length === 0)
|
263 |
+
return '';
|
264 |
+
const writer = new StringWriter();
|
265 |
+
for (let i = 0; i < ranges.length;) {
|
266 |
+
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
|
267 |
+
}
|
268 |
+
return writer.flush();
|
269 |
+
}
|
270 |
+
function _encodeGeneratedRanges(ranges, index, writer, state) {
|
271 |
+
const range = ranges[index];
|
272 |
+
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings, } = range;
|
273 |
+
if (state[0] < startLine) {
|
274 |
+
catchupLine(writer, state[0], startLine);
|
275 |
+
state[0] = startLine;
|
276 |
+
state[1] = 0;
|
277 |
+
}
|
278 |
+
else if (index > 0) {
|
279 |
+
writer.write(comma);
|
280 |
+
}
|
281 |
+
state[1] = encodeInteger(writer, range[1], state[1]);
|
282 |
+
const fields = (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);
|
283 |
+
encodeInteger(writer, fields, 0);
|
284 |
+
if (range.length === 6) {
|
285 |
+
const { 4: sourcesIndex, 5: scopesIndex } = range;
|
286 |
+
if (sourcesIndex !== state[2]) {
|
287 |
+
state[3] = 0;
|
288 |
+
}
|
289 |
+
state[2] = encodeInteger(writer, sourcesIndex, state[2]);
|
290 |
+
state[3] = encodeInteger(writer, scopesIndex, state[3]);
|
291 |
+
}
|
292 |
+
if (callsite) {
|
293 |
+
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
|
294 |
+
if (sourcesIndex !== state[4]) {
|
295 |
+
state[5] = 0;
|
296 |
+
state[6] = 0;
|
297 |
+
}
|
298 |
+
else if (callLine !== state[5]) {
|
299 |
+
state[6] = 0;
|
300 |
+
}
|
301 |
+
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
|
302 |
+
state[5] = encodeInteger(writer, callLine, state[5]);
|
303 |
+
state[6] = encodeInteger(writer, callColumn, state[6]);
|
304 |
+
}
|
305 |
+
if (bindings) {
|
306 |
+
for (const binding of bindings) {
|
307 |
+
if (binding.length > 1)
|
308 |
+
encodeInteger(writer, -binding.length, 0);
|
309 |
+
const expression = binding[0][0];
|
310 |
+
encodeInteger(writer, expression, 0);
|
311 |
+
let bindingStartLine = startLine;
|
312 |
+
let bindingStartColumn = startColumn;
|
313 |
+
for (let i = 1; i < binding.length; i++) {
|
314 |
+
const expRange = binding[i];
|
315 |
+
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
|
316 |
+
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
|
317 |
+
encodeInteger(writer, expRange[0], 0);
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
for (index++; index < ranges.length;) {
|
322 |
+
const next = ranges[index];
|
323 |
+
const { 0: l, 1: c } = next;
|
324 |
+
if (l > endLine || (l === endLine && c >= endColumn)) {
|
325 |
+
break;
|
326 |
+
}
|
327 |
+
index = _encodeGeneratedRanges(ranges, index, writer, state);
|
328 |
+
}
|
329 |
+
if (state[0] < endLine) {
|
330 |
+
catchupLine(writer, state[0], endLine);
|
331 |
+
state[0] = endLine;
|
332 |
+
state[1] = 0;
|
333 |
+
}
|
334 |
+
else {
|
335 |
+
writer.write(comma);
|
336 |
+
}
|
337 |
+
state[1] = encodeInteger(writer, endColumn, state[1]);
|
338 |
+
return index;
|
339 |
+
}
|
340 |
+
function catchupLine(writer, lastLine, line) {
|
341 |
+
do {
|
342 |
+
writer.write(semicolon);
|
343 |
+
} while (++lastLine < line);
|
344 |
+
}
|
345 |
+
|
346 |
+
function decode(mappings) {
|
347 |
+
const { length } = mappings;
|
348 |
+
const reader = new StringReader(mappings);
|
349 |
+
const decoded = [];
|
350 |
+
let genColumn = 0;
|
351 |
+
let sourcesIndex = 0;
|
352 |
+
let sourceLine = 0;
|
353 |
+
let sourceColumn = 0;
|
354 |
+
let namesIndex = 0;
|
355 |
+
do {
|
356 |
+
const semi = reader.indexOf(';');
|
357 |
+
const line = [];
|
358 |
+
let sorted = true;
|
359 |
+
let lastCol = 0;
|
360 |
+
genColumn = 0;
|
361 |
+
while (reader.pos < semi) {
|
362 |
+
let seg;
|
363 |
+
genColumn = decodeInteger(reader, genColumn);
|
364 |
+
if (genColumn < lastCol)
|
365 |
+
sorted = false;
|
366 |
+
lastCol = genColumn;
|
367 |
+
if (hasMoreVlq(reader, semi)) {
|
368 |
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
369 |
+
sourceLine = decodeInteger(reader, sourceLine);
|
370 |
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
371 |
+
if (hasMoreVlq(reader, semi)) {
|
372 |
+
namesIndex = decodeInteger(reader, namesIndex);
|
373 |
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
374 |
+
}
|
375 |
+
else {
|
376 |
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
377 |
+
}
|
378 |
+
}
|
379 |
+
else {
|
380 |
+
seg = [genColumn];
|
381 |
+
}
|
382 |
+
line.push(seg);
|
383 |
+
reader.pos++;
|
384 |
+
}
|
385 |
+
if (!sorted)
|
386 |
+
sort(line);
|
387 |
+
decoded.push(line);
|
388 |
+
reader.pos = semi + 1;
|
389 |
+
} while (reader.pos <= length);
|
390 |
+
return decoded;
|
391 |
+
}
|
392 |
+
function sort(line) {
|
393 |
+
line.sort(sortComparator);
|
394 |
+
}
|
395 |
+
function sortComparator(a, b) {
|
396 |
+
return a[0] - b[0];
|
397 |
+
}
|
398 |
+
function encode(decoded) {
|
399 |
+
const writer = new StringWriter();
|
400 |
+
let sourcesIndex = 0;
|
401 |
+
let sourceLine = 0;
|
402 |
+
let sourceColumn = 0;
|
403 |
+
let namesIndex = 0;
|
404 |
+
for (let i = 0; i < decoded.length; i++) {
|
405 |
+
const line = decoded[i];
|
406 |
+
if (i > 0)
|
407 |
+
writer.write(semicolon);
|
408 |
+
if (line.length === 0)
|
409 |
+
continue;
|
410 |
+
let genColumn = 0;
|
411 |
+
for (let j = 0; j < line.length; j++) {
|
412 |
+
const segment = line[j];
|
413 |
+
if (j > 0)
|
414 |
+
writer.write(comma);
|
415 |
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
416 |
+
if (segment.length === 1)
|
417 |
+
continue;
|
418 |
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
419 |
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
420 |
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
421 |
+
if (segment.length === 4)
|
422 |
+
continue;
|
423 |
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
424 |
+
}
|
425 |
+
}
|
426 |
+
return writer.flush();
|
427 |
+
}
|
428 |
+
|
429 |
+
exports.decode = decode;
|
430 |
+
exports.decodeGeneratedRanges = decodeGeneratedRanges;
|
431 |
+
exports.decodeOriginalScopes = decodeOriginalScopes;
|
432 |
+
exports.encode = encode;
|
433 |
+
exports.encodeGeneratedRanges = encodeGeneratedRanges;
|
434 |
+
exports.encodeOriginalScopes = encodeOriginalScopes;
|
435 |
+
|
436 |
+
Object.defineProperty(exports, '__esModule', { value: true });
|
437 |
+
|
438 |
+
}));
|
439 |
+
//# sourceMappingURL=sourcemap-codec.umd.js.map
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"sourcemap-codec.umd.js","sources":["../src/vlq.ts","../src/strings.ts","../src/scopes.ts","../src/sourcemap-codec.ts"],"sourcesContent":["import type { StringReader, StringWriter } from './strings';\n\nexport const comma = ','.charCodeAt(0);\nexport const semicolon = ';'.charCodeAt(0);\n\nconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst intToChar = new Uint8Array(64); // 64 possible chars.\nconst charToInt = new Uint8Array(128); // z is 122 in ASCII\n\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\n\nexport function decodeInteger(reader: StringReader, relative: number): number {\n let value = 0;\n let shift = 0;\n let integer = 0;\n\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n\n const shouldNegate = value & 1;\n value >>>= 1;\n\n if (shouldNegate) {\n value = -0x80000000 | -value;\n }\n\n return relative + value;\n}\n\nexport function encodeInteger(builder: StringWriter, num: number, relative: number): number {\n let delta = num - relative;\n\n delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;\n do {\n let clamped = delta & 0b011111;\n delta >>>= 5;\n if (delta > 0) clamped |= 0b100000;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n\n return num;\n}\n\nexport function hasMoreVlq(reader: StringReader, max: number) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n","const bufLength = 1024 * 16;\n\n// Provide a fallback for older environments.\nconst td =\n typeof TextDecoder !== 'undefined'\n ? /* #__PURE__ */ new TextDecoder()\n : typeof Buffer !== 'undefined'\n ? {\n decode(buf: Uint8Array): string {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n },\n }\n : {\n decode(buf: Uint8Array): string {\n let out = '';\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n },\n };\n\nexport class StringWriter {\n pos = 0;\n private out = '';\n private buffer = new Uint8Array(bufLength);\n\n write(v: number): void {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n\n flush(): string {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n}\n\nexport class StringReader {\n pos = 0;\n private declare buffer: string;\n\n constructor(buffer: string) {\n this.buffer = buffer;\n }\n\n next(): number {\n return this.buffer.charCodeAt(this.pos++);\n }\n\n peek(): number {\n return this.buffer.charCodeAt(this.pos);\n }\n\n indexOf(char: string): number {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n}\n","import { StringReader, StringWriter } from './strings';\nimport { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\n\nconst EMPTY: any[] = [];\n\ntype Line = number;\ntype Column = number;\ntype Kind = number;\ntype Name = number;\ntype Var = number;\ntype SourcesIndex = number;\ntype ScopesIndex = number;\n\ntype Mix<A, B, O> = (A & O) | (B & O);\n\nexport type OriginalScope = Mix<\n [Line, Column, Line, Column, Kind],\n [Line, Column, Line, Column, Kind, Name],\n { vars: Var[] }\n>;\n\nexport type GeneratedRange = Mix<\n [Line, Column, Line, Column],\n [Line, Column, Line, Column, SourcesIndex, ScopesIndex],\n {\n callsite: CallSite | null;\n bindings: Binding[];\n isScope: boolean;\n }\n>;\nexport type CallSite = [SourcesIndex, Line, Column];\ntype Binding = BindingExpressionRange[];\nexport type BindingExpressionRange = [Name] | [Name, Line, Column];\n\nexport function decodeOriginalScopes(input: string): OriginalScope[] {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes: OriginalScope[] = [];\n const stack: OriginalScope[] = [];\n let line = 0;\n\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop()!;\n last[2] = line;\n last[3] = column;\n continue;\n }\n\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 0b0001;\n\n const scope: OriginalScope = (\n hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]\n ) as OriginalScope;\n\n let vars: Var[] = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n\n scopes.push(scope);\n stack.push(scope);\n }\n\n return scopes;\n}\n\nexport function encodeOriginalScopes(scopes: OriginalScope[]): string {\n const writer = new StringWriter();\n\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeOriginalScopes(\n scopes: OriginalScope[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenColumn\n ],\n): number {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n\n if (index > 0) writer.write(comma);\n\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n\n const fields = scope.length === 6 ? 0b0001 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n\n return index;\n}\n\nexport function decodeGeneratedRanges(input: string): GeneratedRange[] {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges: GeneratedRange[] = [];\n const stack: GeneratedRange[] = [];\n\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n\n do {\n const semi = reader.indexOf(';');\n let genColumn = 0;\n\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop()!;\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 0b0001;\n const hasCallsite = fields & 0b0010;\n const hasScope = fields & 0b0100;\n\n let callsite: CallSite | null = null;\n let bindings: Binding[] = EMPTY;\n let range: GeneratedRange;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0,\n );\n\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange;\n } else {\n range = [genLine, genColumn, 0, 0] as GeneratedRange;\n }\n\n range.isScope = !!hasScope;\n\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0,\n );\n\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges: BindingExpressionRange[];\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n\n ranges.push(range);\n stack.push(range);\n }\n\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n\n return ranges;\n}\n\nexport function encodeGeneratedRanges(ranges: GeneratedRange[]): string {\n if (ranges.length === 0) return '';\n\n const writer = new StringWriter();\n\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeGeneratedRanges(\n ranges: GeneratedRange[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenLine\n number, // GenColumn\n number, // DefSourcesIndex\n number, // DefScopesIndex\n number, // CallSourcesIndex\n number, // CallLine\n number, // CallColumn\n ],\n): number {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings,\n } = range;\n\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n\n state[1] = encodeInteger(writer, range[1], state[1]);\n\n const fields =\n (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);\n encodeInteger(writer, fields, 0);\n\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn);\n encodeInteger(writer, expRange[0]!, 0);\n }\n }\n }\n\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n\n return index;\n}\n\nfunction catchupLine(writer: StringWriter, lastLine: number, line: number) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n","import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\nimport { StringWriter, StringReader } from './strings';\n\nexport {\n decodeOriginalScopes,\n encodeOriginalScopes,\n decodeGeneratedRanges,\n encodeGeneratedRanges,\n} from './scopes';\nexport type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';\n\nexport type SourceMapSegment =\n | [number]\n | [number, number, number, number]\n | [number, number, number, number, number];\nexport type SourceMapLine = SourceMapSegment[];\nexport type SourceMapMappings = SourceMapLine[];\n\nexport function decode(mappings: string): SourceMapMappings {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded: SourceMapMappings = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n do {\n const semi = reader.indexOf(';');\n const line: SourceMapLine = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n\n while (reader.pos < semi) {\n let seg: SourceMapSegment;\n\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n\n line.push(seg);\n reader.pos++;\n }\n\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n\n return decoded;\n}\n\nfunction sort(line: SourceMapSegment[]) {\n line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[0] - b[0];\n}\n\nexport function encode(decoded: SourceMapMappings): string;\nexport function encode(decoded: Readonly<SourceMapMappings>): string;\nexport function encode(decoded: Readonly<SourceMapMappings>): string {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n\n let genColumn = 0;\n\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n\n genColumn = encodeInteger(writer, segment[0], genColumn);\n\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n\n return writer.flush();\n}\n"],"names":[],"mappings":";;;;;;IAEO,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE3C,MAAM,KAAK,GAAG,kEAAkE,CAAC;IACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAClB;aAEe,aAAa,CAAC,MAAoB,EAAE,QAAgB;QAClE,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,OAAO,GAAG,CAAC,CAAC;QAEhB,GAAG;YACD,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACxB,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACvB,KAAK,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,KAA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IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAE/B,SAAS,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;gBAEzD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBACnC,YAAY,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;gBAC/D,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAC3D,YAAY,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;gBAE/D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBACnC,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;aAC5D;SACF;QAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;IACxB;;;;;;;;;;;;;;;"}
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
declare type Line = number;
|
2 |
+
declare type Column = number;
|
3 |
+
declare type Kind = number;
|
4 |
+
declare type Name = number;
|
5 |
+
declare type Var = number;
|
6 |
+
declare type SourcesIndex = number;
|
7 |
+
declare type ScopesIndex = number;
|
8 |
+
declare type Mix<A, B, O> = (A & O) | (B & O);
|
9 |
+
export declare type OriginalScope = Mix<[
|
10 |
+
Line,
|
11 |
+
Column,
|
12 |
+
Line,
|
13 |
+
Column,
|
14 |
+
Kind
|
15 |
+
], [
|
16 |
+
Line,
|
17 |
+
Column,
|
18 |
+
Line,
|
19 |
+
Column,
|
20 |
+
Kind,
|
21 |
+
Name
|
22 |
+
], {
|
23 |
+
vars: Var[];
|
24 |
+
}>;
|
25 |
+
export declare type GeneratedRange = Mix<[
|
26 |
+
Line,
|
27 |
+
Column,
|
28 |
+
Line,
|
29 |
+
Column
|
30 |
+
], [
|
31 |
+
Line,
|
32 |
+
Column,
|
33 |
+
Line,
|
34 |
+
Column,
|
35 |
+
SourcesIndex,
|
36 |
+
ScopesIndex
|
37 |
+
], {
|
38 |
+
callsite: CallSite | null;
|
39 |
+
bindings: Binding[];
|
40 |
+
isScope: boolean;
|
41 |
+
}>;
|
42 |
+
export declare type CallSite = [SourcesIndex, Line, Column];
|
43 |
+
declare type Binding = BindingExpressionRange[];
|
44 |
+
export declare type BindingExpressionRange = [Name] | [Name, Line, Column];
|
45 |
+
export declare function decodeOriginalScopes(input: string): OriginalScope[];
|
46 |
+
export declare function encodeOriginalScopes(scopes: OriginalScope[]): string;
|
47 |
+
export declare function decodeGeneratedRanges(input: string): GeneratedRange[];
|
48 |
+
export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string;
|
49 |
+
export {};
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes';
|
2 |
+
export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';
|
3 |
+
export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number];
|
4 |
+
export declare type SourceMapLine = SourceMapSegment[];
|
5 |
+
export declare type SourceMapMappings = SourceMapLine[];
|
6 |
+
export declare function decode(mappings: string): SourceMapMappings;
|
7 |
+
export declare function encode(decoded: SourceMapMappings): string;
|
8 |
+
export declare function encode(decoded: Readonly<SourceMapMappings>): string;
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export declare class StringWriter {
|
2 |
+
pos: number;
|
3 |
+
private out;
|
4 |
+
private buffer;
|
5 |
+
write(v: number): void;
|
6 |
+
flush(): string;
|
7 |
+
}
|
8 |
+
export declare class StringReader {
|
9 |
+
pos: number;
|
10 |
+
private buffer;
|
11 |
+
constructor(buffer: string);
|
12 |
+
next(): number;
|
13 |
+
peek(): number;
|
14 |
+
indexOf(char: string): number;
|
15 |
+
}
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import type { StringReader, StringWriter } from './strings';
|
2 |
+
export declare const comma: number;
|
3 |
+
export declare const semicolon: number;
|
4 |
+
export declare function decodeInteger(reader: StringReader, relative: number): number;
|
5 |
+
export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number;
|
6 |
+
export declare function hasMoreVlq(reader: StringReader, max: number): boolean;
|
workers1/auto3d/node_modules/@jridgewell/sourcemap-codec/package.json
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@jridgewell/sourcemap-codec",
|
3 |
+
"version": "1.5.0",
|
4 |
+
"description": "Encode/decode sourcemap mappings",
|
5 |
+
"keywords": [
|
6 |
+
"sourcemap",
|
7 |
+
"vlq"
|
8 |
+
],
|
9 |
+
"main": "dist/sourcemap-codec.umd.js",
|
10 |
+
"module": "dist/sourcemap-codec.mjs",
|
11 |
+
"types": "dist/types/sourcemap-codec.d.ts",
|
12 |
+
"files": [
|
13 |
+
"dist"
|
14 |
+
],
|
15 |
+
"exports": {
|
16 |
+
".": [
|
17 |
+
{
|
18 |
+
"types": "./dist/types/sourcemap-codec.d.ts",
|
19 |
+
"browser": "./dist/sourcemap-codec.umd.js",
|
20 |
+
"require": "./dist/sourcemap-codec.umd.js",
|
21 |
+
"import": "./dist/sourcemap-codec.mjs"
|
22 |
+
},
|
23 |
+
"./dist/sourcemap-codec.umd.js"
|
24 |
+
],
|
25 |
+
"./package.json": "./package.json"
|
26 |
+
},
|
27 |
+
"scripts": {
|
28 |
+
"benchmark": "run-s build:rollup benchmark:*",
|
29 |
+
"benchmark:install": "cd benchmark && npm install",
|
30 |
+
"benchmark:only": "node --expose-gc benchmark/index.js",
|
31 |
+
"build": "run-s -n build:*",
|
32 |
+
"build:rollup": "rollup -c rollup.config.js",
|
33 |
+
"build:ts": "tsc --project tsconfig.build.json",
|
34 |
+
"lint": "run-s -n lint:*",
|
35 |
+
"lint:prettier": "npm run test:lint:prettier -- --write",
|
36 |
+
"lint:ts": "npm run test:lint:ts -- --fix",
|
37 |
+
"prebuild": "rm -rf dist",
|
38 |
+
"prepublishOnly": "npm run preversion",
|
39 |
+
"preversion": "run-s test build",
|
40 |
+
"test": "run-s -n test:lint test:only",
|
41 |
+
"test:debug": "mocha --inspect-brk",
|
42 |
+
"test:lint": "run-s -n test:lint:*",
|
43 |
+
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
44 |
+
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
45 |
+
"test:only": "mocha",
|
46 |
+
"test:coverage": "c8 mocha",
|
47 |
+
"test:watch": "mocha --watch"
|
48 |
+
},
|
49 |
+
"repository": {
|
50 |
+
"type": "git",
|
51 |
+
"url": "git+https://github.com/jridgewell/sourcemap-codec.git"
|
52 |
+
},
|
53 |
+
"author": "Rich Harris",
|
54 |
+
"license": "MIT",
|
55 |
+
"devDependencies": {
|
56 |
+
"@rollup/plugin-typescript": "8.3.0",
|
57 |
+
"@types/mocha": "10.0.6",
|
58 |
+
"@types/node": "17.0.15",
|
59 |
+
"@typescript-eslint/eslint-plugin": "5.10.0",
|
60 |
+
"@typescript-eslint/parser": "5.10.0",
|
61 |
+
"benchmark": "2.1.4",
|
62 |
+
"c8": "7.11.2",
|
63 |
+
"eslint": "8.7.0",
|
64 |
+
"eslint-config-prettier": "8.3.0",
|
65 |
+
"mocha": "9.2.0",
|
66 |
+
"npm-run-all": "4.1.5",
|
67 |
+
"prettier": "2.5.1",
|
68 |
+
"rollup": "2.64.0",
|
69 |
+
"source-map": "0.6.1",
|
70 |
+
"source-map-js": "1.0.2",
|
71 |
+
"sourcemap-codec": "1.4.8",
|
72 |
+
"tsx": "4.7.1",
|
73 |
+
"typescript": "4.5.4"
|
74 |
+
}
|
75 |
+
}
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright 2022 Justin Ridgewell <[email protected]>
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is
|
8 |
+
furnished to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in
|
11 |
+
all copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19 |
+
SOFTWARE.
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/README.md
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# @jridgewell/trace-mapping
|
2 |
+
|
3 |
+
> Trace the original position through a source map
|
4 |
+
|
5 |
+
`trace-mapping` allows you to take the line and column of an output file and trace it to the
|
6 |
+
original location in the source file through a source map.
|
7 |
+
|
8 |
+
You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This
|
9 |
+
provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM.
|
10 |
+
|
11 |
+
## Installation
|
12 |
+
|
13 |
+
```sh
|
14 |
+
npm install @jridgewell/trace-mapping
|
15 |
+
```
|
16 |
+
|
17 |
+
## Usage
|
18 |
+
|
19 |
+
```typescript
|
20 |
+
import { TraceMap, originalPositionFor, generatedPositionFor } from '@jridgewell/trace-mapping';
|
21 |
+
|
22 |
+
const tracer = new TraceMap({
|
23 |
+
version: 3,
|
24 |
+
sources: ['input.js'],
|
25 |
+
names: ['foo'],
|
26 |
+
mappings: 'KAyCIA',
|
27 |
+
});
|
28 |
+
|
29 |
+
// Lines start at line 1, columns at column 0.
|
30 |
+
const traced = originalPositionFor(tracer, { line: 1, column: 5 });
|
31 |
+
assert.deepEqual(traced, {
|
32 |
+
source: 'input.js',
|
33 |
+
line: 42,
|
34 |
+
column: 4,
|
35 |
+
name: 'foo',
|
36 |
+
});
|
37 |
+
|
38 |
+
const generated = generatedPositionFor(tracer, {
|
39 |
+
source: 'input.js',
|
40 |
+
line: 42,
|
41 |
+
column: 4,
|
42 |
+
});
|
43 |
+
assert.deepEqual(generated, {
|
44 |
+
line: 1,
|
45 |
+
column: 5,
|
46 |
+
});
|
47 |
+
```
|
48 |
+
|
49 |
+
We also provide a lower level API to get the actual segment that matches our line and column. Unlike
|
50 |
+
`originalPositionFor`, `traceSegment` uses a 0-base for `line`:
|
51 |
+
|
52 |
+
```typescript
|
53 |
+
import { traceSegment } from '@jridgewell/trace-mapping';
|
54 |
+
|
55 |
+
// line is 0-base.
|
56 |
+
const traced = traceSegment(tracer, /* line */ 0, /* column */ 5);
|
57 |
+
|
58 |
+
// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
|
59 |
+
// Again, line is 0-base and so is sourceLine
|
60 |
+
assert.deepEqual(traced, [5, 0, 41, 4, 0]);
|
61 |
+
```
|
62 |
+
|
63 |
+
### SectionedSourceMaps
|
64 |
+
|
65 |
+
The sourcemap spec defines a special `sections` field that's designed to handle concatenation of
|
66 |
+
output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool
|
67 |
+
produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap`
|
68 |
+
helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a
|
69 |
+
`TraceMap` instance:
|
70 |
+
|
71 |
+
```typescript
|
72 |
+
import { AnyMap } from '@jridgewell/trace-mapping';
|
73 |
+
const fooOutput = 'foo';
|
74 |
+
const barOutput = 'bar';
|
75 |
+
const output = [fooOutput, barOutput].join('\n');
|
76 |
+
|
77 |
+
const sectioned = new AnyMap({
|
78 |
+
version: 3,
|
79 |
+
sections: [
|
80 |
+
{
|
81 |
+
// 0-base line and column
|
82 |
+
offset: { line: 0, column: 0 },
|
83 |
+
// fooOutput's sourcemap
|
84 |
+
map: {
|
85 |
+
version: 3,
|
86 |
+
sources: ['foo.js'],
|
87 |
+
names: ['foo'],
|
88 |
+
mappings: 'AAAAA',
|
89 |
+
},
|
90 |
+
},
|
91 |
+
{
|
92 |
+
// barOutput's sourcemap will not affect the first line, only the second
|
93 |
+
offset: { line: 1, column: 0 },
|
94 |
+
map: {
|
95 |
+
version: 3,
|
96 |
+
sources: ['bar.js'],
|
97 |
+
names: ['bar'],
|
98 |
+
mappings: 'AAAAA',
|
99 |
+
},
|
100 |
+
},
|
101 |
+
],
|
102 |
+
});
|
103 |
+
|
104 |
+
const traced = originalPositionFor(sectioned, {
|
105 |
+
line: 2,
|
106 |
+
column: 0,
|
107 |
+
});
|
108 |
+
|
109 |
+
assert.deepEqual(traced, {
|
110 |
+
source: 'bar.js',
|
111 |
+
line: 1,
|
112 |
+
column: 0,
|
113 |
+
name: 'bar',
|
114 |
+
});
|
115 |
+
```
|
116 |
+
|
117 |
+
## Benchmarks
|
118 |
+
|
119 |
+
```
|
120 |
+
node v18.0.0
|
121 |
+
|
122 |
+
amp.js.map
|
123 |
+
trace-mapping: decoded JSON input x 183 ops/sec ±0.41% (87 runs sampled)
|
124 |
+
trace-mapping: encoded JSON input x 384 ops/sec ±0.89% (89 runs sampled)
|
125 |
+
trace-mapping: decoded Object input x 3,085 ops/sec ±0.24% (100 runs sampled)
|
126 |
+
trace-mapping: encoded Object input x 452 ops/sec ±0.80% (84 runs sampled)
|
127 |
+
source-map-js: encoded Object input x 88.82 ops/sec ±0.45% (77 runs sampled)
|
128 |
+
source-map-0.6.1: encoded Object input x 38.39 ops/sec ±1.88% (52 runs sampled)
|
129 |
+
Fastest is trace-mapping: decoded Object input
|
130 |
+
|
131 |
+
trace-mapping: decoded originalPositionFor x 4,025,347 ops/sec ±0.15% (97 runs sampled)
|
132 |
+
trace-mapping: encoded originalPositionFor x 3,333,136 ops/sec ±1.26% (90 runs sampled)
|
133 |
+
source-map-js: encoded originalPositionFor x 824,978 ops/sec ±1.06% (94 runs sampled)
|
134 |
+
source-map-0.6.1: encoded originalPositionFor x 741,300 ops/sec ±0.93% (92 runs sampled)
|
135 |
+
source-map-0.8.0: encoded originalPositionFor x 2,587,603 ops/sec ±0.75% (97 runs sampled)
|
136 |
+
Fastest is trace-mapping: decoded originalPositionFor
|
137 |
+
|
138 |
+
***
|
139 |
+
|
140 |
+
babel.min.js.map
|
141 |
+
trace-mapping: decoded JSON input x 17.43 ops/sec ±8.81% (33 runs sampled)
|
142 |
+
trace-mapping: encoded JSON input x 34.18 ops/sec ±4.67% (50 runs sampled)
|
143 |
+
trace-mapping: decoded Object input x 1,010 ops/sec ±0.41% (98 runs sampled)
|
144 |
+
trace-mapping: encoded Object input x 39.45 ops/sec ±4.01% (52 runs sampled)
|
145 |
+
source-map-js: encoded Object input x 6.57 ops/sec ±3.04% (21 runs sampled)
|
146 |
+
source-map-0.6.1: encoded Object input x 4.23 ops/sec ±2.93% (15 runs sampled)
|
147 |
+
Fastest is trace-mapping: decoded Object input
|
148 |
+
|
149 |
+
trace-mapping: decoded originalPositionFor x 7,576,265 ops/sec ±0.74% (96 runs sampled)
|
150 |
+
trace-mapping: encoded originalPositionFor x 5,019,743 ops/sec ±0.74% (94 runs sampled)
|
151 |
+
source-map-js: encoded originalPositionFor x 3,396,137 ops/sec ±42.32% (95 runs sampled)
|
152 |
+
source-map-0.6.1: encoded originalPositionFor x 3,753,176 ops/sec ±0.72% (95 runs sampled)
|
153 |
+
source-map-0.8.0: encoded originalPositionFor x 6,423,633 ops/sec ±0.74% (95 runs sampled)
|
154 |
+
Fastest is trace-mapping: decoded originalPositionFor
|
155 |
+
|
156 |
+
***
|
157 |
+
|
158 |
+
preact.js.map
|
159 |
+
trace-mapping: decoded JSON input x 3,499 ops/sec ±0.18% (98 runs sampled)
|
160 |
+
trace-mapping: encoded JSON input x 6,078 ops/sec ±0.25% (99 runs sampled)
|
161 |
+
trace-mapping: decoded Object input x 254,788 ops/sec ±0.13% (100 runs sampled)
|
162 |
+
trace-mapping: encoded Object input x 14,063 ops/sec ±0.27% (94 runs sampled)
|
163 |
+
source-map-js: encoded Object input x 2,465 ops/sec ±0.25% (98 runs sampled)
|
164 |
+
source-map-0.6.1: encoded Object input x 1,174 ops/sec ±1.90% (95 runs sampled)
|
165 |
+
Fastest is trace-mapping: decoded Object input
|
166 |
+
|
167 |
+
trace-mapping: decoded originalPositionFor x 7,720,171 ops/sec ±0.14% (97 runs sampled)
|
168 |
+
trace-mapping: encoded originalPositionFor x 6,864,485 ops/sec ±0.16% (101 runs sampled)
|
169 |
+
source-map-js: encoded originalPositionFor x 2,387,219 ops/sec ±0.28% (98 runs sampled)
|
170 |
+
source-map-0.6.1: encoded originalPositionFor x 1,565,339 ops/sec ±0.32% (101 runs sampled)
|
171 |
+
source-map-0.8.0: encoded originalPositionFor x 3,819,732 ops/sec ±0.38% (98 runs sampled)
|
172 |
+
Fastest is trace-mapping: decoded originalPositionFor
|
173 |
+
|
174 |
+
***
|
175 |
+
|
176 |
+
react.js.map
|
177 |
+
trace-mapping: decoded JSON input x 1,719 ops/sec ±0.19% (99 runs sampled)
|
178 |
+
trace-mapping: encoded JSON input x 4,284 ops/sec ±0.51% (99 runs sampled)
|
179 |
+
trace-mapping: decoded Object input x 94,668 ops/sec ±0.08% (99 runs sampled)
|
180 |
+
trace-mapping: encoded Object input x 5,287 ops/sec ±0.24% (99 runs sampled)
|
181 |
+
source-map-js: encoded Object input x 814 ops/sec ±0.20% (98 runs sampled)
|
182 |
+
source-map-0.6.1: encoded Object input x 429 ops/sec ±0.24% (94 runs sampled)
|
183 |
+
Fastest is trace-mapping: decoded Object input
|
184 |
+
|
185 |
+
trace-mapping: decoded originalPositionFor x 28,927,989 ops/sec ±0.61% (94 runs sampled)
|
186 |
+
trace-mapping: encoded originalPositionFor x 27,394,475 ops/sec ±0.55% (97 runs sampled)
|
187 |
+
source-map-js: encoded originalPositionFor x 16,856,730 ops/sec ±0.45% (96 runs sampled)
|
188 |
+
source-map-0.6.1: encoded originalPositionFor x 12,258,950 ops/sec ±0.41% (97 runs sampled)
|
189 |
+
source-map-0.8.0: encoded originalPositionFor x 22,272,990 ops/sec ±0.58% (95 runs sampled)
|
190 |
+
Fastest is trace-mapping: decoded originalPositionFor
|
191 |
+
```
|
192 |
+
|
193 |
+
[source-map]: https://www.npmjs.com/package/source-map
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
ADDED
@@ -0,0 +1,514 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
2 |
+
import resolveUri from '@jridgewell/resolve-uri';
|
3 |
+
|
4 |
+
function resolve(input, base) {
|
5 |
+
// The base is always treated as a directory, if it's not empty.
|
6 |
+
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
7 |
+
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
8 |
+
if (base && !base.endsWith('/'))
|
9 |
+
base += '/';
|
10 |
+
return resolveUri(input, base);
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Removes everything after the last "/", but leaves the slash.
|
15 |
+
*/
|
16 |
+
function stripFilename(path) {
|
17 |
+
if (!path)
|
18 |
+
return '';
|
19 |
+
const index = path.lastIndexOf('/');
|
20 |
+
return path.slice(0, index + 1);
|
21 |
+
}
|
22 |
+
|
23 |
+
const COLUMN = 0;
|
24 |
+
const SOURCES_INDEX = 1;
|
25 |
+
const SOURCE_LINE = 2;
|
26 |
+
const SOURCE_COLUMN = 3;
|
27 |
+
const NAMES_INDEX = 4;
|
28 |
+
const REV_GENERATED_LINE = 1;
|
29 |
+
const REV_GENERATED_COLUMN = 2;
|
30 |
+
|
31 |
+
function maybeSort(mappings, owned) {
|
32 |
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
33 |
+
if (unsortedIndex === mappings.length)
|
34 |
+
return mappings;
|
35 |
+
// If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
|
36 |
+
// not, we do not want to modify the consumer's input array.
|
37 |
+
if (!owned)
|
38 |
+
mappings = mappings.slice();
|
39 |
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
40 |
+
mappings[i] = sortSegments(mappings[i], owned);
|
41 |
+
}
|
42 |
+
return mappings;
|
43 |
+
}
|
44 |
+
function nextUnsortedSegmentLine(mappings, start) {
|
45 |
+
for (let i = start; i < mappings.length; i++) {
|
46 |
+
if (!isSorted(mappings[i]))
|
47 |
+
return i;
|
48 |
+
}
|
49 |
+
return mappings.length;
|
50 |
+
}
|
51 |
+
function isSorted(line) {
|
52 |
+
for (let j = 1; j < line.length; j++) {
|
53 |
+
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
return true;
|
58 |
+
}
|
59 |
+
function sortSegments(line, owned) {
|
60 |
+
if (!owned)
|
61 |
+
line = line.slice();
|
62 |
+
return line.sort(sortComparator);
|
63 |
+
}
|
64 |
+
function sortComparator(a, b) {
|
65 |
+
return a[COLUMN] - b[COLUMN];
|
66 |
+
}
|
67 |
+
|
68 |
+
let found = false;
|
69 |
+
/**
|
70 |
+
* A binary search implementation that returns the index if a match is found.
|
71 |
+
* If no match is found, then the left-index (the index associated with the item that comes just
|
72 |
+
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
73 |
+
* the next index:
|
74 |
+
*
|
75 |
+
* ```js
|
76 |
+
* const array = [1, 3];
|
77 |
+
* const needle = 2;
|
78 |
+
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
79 |
+
*
|
80 |
+
* assert.equal(index, 0);
|
81 |
+
* array.splice(index + 1, 0, needle);
|
82 |
+
* assert.deepEqual(array, [1, 2, 3]);
|
83 |
+
* ```
|
84 |
+
*/
|
85 |
+
function binarySearch(haystack, needle, low, high) {
|
86 |
+
while (low <= high) {
|
87 |
+
const mid = low + ((high - low) >> 1);
|
88 |
+
const cmp = haystack[mid][COLUMN] - needle;
|
89 |
+
if (cmp === 0) {
|
90 |
+
found = true;
|
91 |
+
return mid;
|
92 |
+
}
|
93 |
+
if (cmp < 0) {
|
94 |
+
low = mid + 1;
|
95 |
+
}
|
96 |
+
else {
|
97 |
+
high = mid - 1;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
found = false;
|
101 |
+
return low - 1;
|
102 |
+
}
|
103 |
+
function upperBound(haystack, needle, index) {
|
104 |
+
for (let i = index + 1; i < haystack.length; i++, index++) {
|
105 |
+
if (haystack[i][COLUMN] !== needle)
|
106 |
+
break;
|
107 |
+
}
|
108 |
+
return index;
|
109 |
+
}
|
110 |
+
function lowerBound(haystack, needle, index) {
|
111 |
+
for (let i = index - 1; i >= 0; i--, index--) {
|
112 |
+
if (haystack[i][COLUMN] !== needle)
|
113 |
+
break;
|
114 |
+
}
|
115 |
+
return index;
|
116 |
+
}
|
117 |
+
function memoizedState() {
|
118 |
+
return {
|
119 |
+
lastKey: -1,
|
120 |
+
lastNeedle: -1,
|
121 |
+
lastIndex: -1,
|
122 |
+
};
|
123 |
+
}
|
124 |
+
/**
|
125 |
+
* This overly complicated beast is just to record the last tested line/column and the resulting
|
126 |
+
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
127 |
+
*/
|
128 |
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
129 |
+
const { lastKey, lastNeedle, lastIndex } = state;
|
130 |
+
let low = 0;
|
131 |
+
let high = haystack.length - 1;
|
132 |
+
if (key === lastKey) {
|
133 |
+
if (needle === lastNeedle) {
|
134 |
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
135 |
+
return lastIndex;
|
136 |
+
}
|
137 |
+
if (needle >= lastNeedle) {
|
138 |
+
// lastIndex may be -1 if the previous needle was not found.
|
139 |
+
low = lastIndex === -1 ? 0 : lastIndex;
|
140 |
+
}
|
141 |
+
else {
|
142 |
+
high = lastIndex;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
state.lastKey = key;
|
146 |
+
state.lastNeedle = needle;
|
147 |
+
return (state.lastIndex = binarySearch(haystack, needle, low, high));
|
148 |
+
}
|
149 |
+
|
150 |
+
// Rebuilds the original source files, with mappings that are ordered by source line/column instead
|
151 |
+
// of generated line/column.
|
152 |
+
function buildBySources(decoded, memos) {
|
153 |
+
const sources = memos.map(buildNullArray);
|
154 |
+
for (let i = 0; i < decoded.length; i++) {
|
155 |
+
const line = decoded[i];
|
156 |
+
for (let j = 0; j < line.length; j++) {
|
157 |
+
const seg = line[j];
|
158 |
+
if (seg.length === 1)
|
159 |
+
continue;
|
160 |
+
const sourceIndex = seg[SOURCES_INDEX];
|
161 |
+
const sourceLine = seg[SOURCE_LINE];
|
162 |
+
const sourceColumn = seg[SOURCE_COLUMN];
|
163 |
+
const originalSource = sources[sourceIndex];
|
164 |
+
const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = []));
|
165 |
+
const memo = memos[sourceIndex];
|
166 |
+
// The binary search either found a match, or it found the left-index just before where the
|
167 |
+
// segment should go. Either way, we want to insert after that. And there may be multiple
|
168 |
+
// generated segments associated with an original location, so there may need to move several
|
169 |
+
// indexes before we find where we need to insert.
|
170 |
+
const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine));
|
171 |
+
insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
return sources;
|
175 |
+
}
|
176 |
+
function insert(array, index, value) {
|
177 |
+
for (let i = array.length; i > index; i--) {
|
178 |
+
array[i] = array[i - 1];
|
179 |
+
}
|
180 |
+
array[index] = value;
|
181 |
+
}
|
182 |
+
// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
|
183 |
+
// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
|
184 |
+
// Numeric properties on objects are magically sorted in ascending order by the engine regardless of
|
185 |
+
// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
|
186 |
+
// order when iterating with for-in.
|
187 |
+
function buildNullArray() {
|
188 |
+
return { __proto__: null };
|
189 |
+
}
|
190 |
+
|
191 |
+
const AnyMap = function (map, mapUrl) {
|
192 |
+
const parsed = typeof map === 'string' ? JSON.parse(map) : map;
|
193 |
+
if (!('sections' in parsed))
|
194 |
+
return new TraceMap(parsed, mapUrl);
|
195 |
+
const mappings = [];
|
196 |
+
const sources = [];
|
197 |
+
const sourcesContent = [];
|
198 |
+
const names = [];
|
199 |
+
const { sections } = parsed;
|
200 |
+
let i = 0;
|
201 |
+
for (; i < sections.length - 1; i++) {
|
202 |
+
const no = sections[i + 1].offset;
|
203 |
+
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column);
|
204 |
+
}
|
205 |
+
if (sections.length > 0) {
|
206 |
+
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity);
|
207 |
+
}
|
208 |
+
const joined = {
|
209 |
+
version: 3,
|
210 |
+
file: parsed.file,
|
211 |
+
names,
|
212 |
+
sources,
|
213 |
+
sourcesContent,
|
214 |
+
mappings,
|
215 |
+
};
|
216 |
+
return presortedDecodedMap(joined);
|
217 |
+
};
|
218 |
+
function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) {
|
219 |
+
const map = AnyMap(section.map, mapUrl);
|
220 |
+
const { line: lineOffset, column: columnOffset } = section.offset;
|
221 |
+
const sourcesOffset = sources.length;
|
222 |
+
const namesOffset = names.length;
|
223 |
+
const decoded = decodedMappings(map);
|
224 |
+
const { resolvedSources } = map;
|
225 |
+
append(sources, resolvedSources);
|
226 |
+
append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length));
|
227 |
+
append(names, map.names);
|
228 |
+
// If this section jumps forwards several lines, we need to add lines to the output mappings catch up.
|
229 |
+
for (let i = mappings.length; i <= lineOffset; i++)
|
230 |
+
mappings.push([]);
|
231 |
+
// We can only add so many lines before we step into the range that the next section's map
|
232 |
+
// controls. When we get to the last line, then we'll start checking the segments to see if
|
233 |
+
// they've crossed into the column range.
|
234 |
+
const stopI = stopLine - lineOffset;
|
235 |
+
const len = Math.min(decoded.length, stopI + 1);
|
236 |
+
for (let i = 0; i < len; i++) {
|
237 |
+
const line = decoded[i];
|
238 |
+
// On the 0th loop, the line will already exist due to a previous section, or the line catch up
|
239 |
+
// loop above.
|
240 |
+
const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []);
|
241 |
+
// On the 0th loop, the section's column offset shifts us forward. On all other lines (since the
|
242 |
+
// map can be multiple lines), it doesn't.
|
243 |
+
const cOffset = i === 0 ? columnOffset : 0;
|
244 |
+
for (let j = 0; j < line.length; j++) {
|
245 |
+
const seg = line[j];
|
246 |
+
const column = cOffset + seg[COLUMN];
|
247 |
+
// If this segment steps into the column range that the next section's map controls, we need
|
248 |
+
// to stop early.
|
249 |
+
if (i === stopI && column >= stopColumn)
|
250 |
+
break;
|
251 |
+
if (seg.length === 1) {
|
252 |
+
out.push([column]);
|
253 |
+
continue;
|
254 |
+
}
|
255 |
+
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
|
256 |
+
const sourceLine = seg[SOURCE_LINE];
|
257 |
+
const sourceColumn = seg[SOURCE_COLUMN];
|
258 |
+
if (seg.length === 4) {
|
259 |
+
out.push([column, sourcesIndex, sourceLine, sourceColumn]);
|
260 |
+
continue;
|
261 |
+
}
|
262 |
+
out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
function append(arr, other) {
|
267 |
+
for (let i = 0; i < other.length; i++)
|
268 |
+
arr.push(other[i]);
|
269 |
+
}
|
270 |
+
// Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of
|
271 |
+
// equal length to the sources. This is because the sources and sourcesContent are paired arrays,
|
272 |
+
// where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined
|
273 |
+
// sourcemap would desynchronize the sources/contents.
|
274 |
+
function fillSourcesContent(len) {
|
275 |
+
const sourcesContent = [];
|
276 |
+
for (let i = 0; i < len; i++)
|
277 |
+
sourcesContent[i] = null;
|
278 |
+
return sourcesContent;
|
279 |
+
}
|
280 |
+
|
281 |
+
const INVALID_ORIGINAL_MAPPING = Object.freeze({
|
282 |
+
source: null,
|
283 |
+
line: null,
|
284 |
+
column: null,
|
285 |
+
name: null,
|
286 |
+
});
|
287 |
+
const INVALID_GENERATED_MAPPING = Object.freeze({
|
288 |
+
line: null,
|
289 |
+
column: null,
|
290 |
+
});
|
291 |
+
const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
|
292 |
+
const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
|
293 |
+
const LEAST_UPPER_BOUND = -1;
|
294 |
+
const GREATEST_LOWER_BOUND = 1;
|
295 |
+
/**
|
296 |
+
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
297 |
+
*/
|
298 |
+
let encodedMappings;
|
299 |
+
/**
|
300 |
+
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
301 |
+
*/
|
302 |
+
let decodedMappings;
|
303 |
+
/**
|
304 |
+
* A low-level API to find the segment associated with a generated line/column (think, from a
|
305 |
+
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
306 |
+
*/
|
307 |
+
let traceSegment;
|
308 |
+
/**
|
309 |
+
* A higher-level API to find the source/line/column associated with a generated line/column
|
310 |
+
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
311 |
+
* `source-map` library.
|
312 |
+
*/
|
313 |
+
let originalPositionFor;
|
314 |
+
/**
|
315 |
+
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
316 |
+
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
317 |
+
*
|
318 |
+
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
319 |
+
* using the same needle that would return `id` when calling `originalPositionFor`.
|
320 |
+
*/
|
321 |
+
let generatedPositionFor;
|
322 |
+
/**
|
323 |
+
* Iterates each mapping in generated position order.
|
324 |
+
*/
|
325 |
+
let eachMapping;
|
326 |
+
/**
|
327 |
+
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
328 |
+
* maps.
|
329 |
+
*/
|
330 |
+
let presortedDecodedMap;
|
331 |
+
/**
|
332 |
+
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
333 |
+
* a sourcemap, or to JSON.stringify.
|
334 |
+
*/
|
335 |
+
let decodedMap;
|
336 |
+
/**
|
337 |
+
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
338 |
+
* a sourcemap, or to JSON.stringify.
|
339 |
+
*/
|
340 |
+
let encodedMap;
|
341 |
+
class TraceMap {
|
342 |
+
constructor(map, mapUrl) {
|
343 |
+
this._decodedMemo = memoizedState();
|
344 |
+
this._bySources = undefined;
|
345 |
+
this._bySourceMemos = undefined;
|
346 |
+
const isString = typeof map === 'string';
|
347 |
+
if (!isString && map.constructor === TraceMap)
|
348 |
+
return map;
|
349 |
+
const parsed = (isString ? JSON.parse(map) : map);
|
350 |
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
351 |
+
this.version = version;
|
352 |
+
this.file = file;
|
353 |
+
this.names = names;
|
354 |
+
this.sourceRoot = sourceRoot;
|
355 |
+
this.sources = sources;
|
356 |
+
this.sourcesContent = sourcesContent;
|
357 |
+
if (sourceRoot || mapUrl) {
|
358 |
+
const from = resolve(sourceRoot || '', stripFilename(mapUrl));
|
359 |
+
this.resolvedSources = sources.map((s) => resolve(s || '', from));
|
360 |
+
}
|
361 |
+
else {
|
362 |
+
this.resolvedSources = sources.map((s) => s || '');
|
363 |
+
}
|
364 |
+
const { mappings } = parsed;
|
365 |
+
if (typeof mappings === 'string') {
|
366 |
+
this._encoded = mappings;
|
367 |
+
this._decoded = undefined;
|
368 |
+
}
|
369 |
+
else {
|
370 |
+
this._encoded = undefined;
|
371 |
+
this._decoded = maybeSort(mappings, isString);
|
372 |
+
}
|
373 |
+
}
|
374 |
+
}
|
375 |
+
(() => {
|
376 |
+
encodedMappings = (map) => {
|
377 |
+
var _a;
|
378 |
+
return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode(map._decoded)));
|
379 |
+
};
|
380 |
+
decodedMappings = (map) => {
|
381 |
+
return (map._decoded || (map._decoded = decode(map._encoded)));
|
382 |
+
};
|
383 |
+
traceSegment = (map, line, column) => {
|
384 |
+
const decoded = decodedMappings(map);
|
385 |
+
// It's common for parent source maps to have pointers to lines that have no
|
386 |
+
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
387 |
+
if (line >= decoded.length)
|
388 |
+
return null;
|
389 |
+
return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
390 |
+
};
|
391 |
+
originalPositionFor = (map, { line, column, bias }) => {
|
392 |
+
line--;
|
393 |
+
if (line < 0)
|
394 |
+
throw new Error(LINE_GTR_ZERO);
|
395 |
+
if (column < 0)
|
396 |
+
throw new Error(COL_GTR_EQ_ZERO);
|
397 |
+
const decoded = decodedMappings(map);
|
398 |
+
// It's common for parent source maps to have pointers to lines that have no
|
399 |
+
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
400 |
+
if (line >= decoded.length)
|
401 |
+
return INVALID_ORIGINAL_MAPPING;
|
402 |
+
const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
403 |
+
if (segment == null)
|
404 |
+
return INVALID_ORIGINAL_MAPPING;
|
405 |
+
if (segment.length == 1)
|
406 |
+
return INVALID_ORIGINAL_MAPPING;
|
407 |
+
const { names, resolvedSources } = map;
|
408 |
+
return {
|
409 |
+
source: resolvedSources[segment[SOURCES_INDEX]],
|
410 |
+
line: segment[SOURCE_LINE] + 1,
|
411 |
+
column: segment[SOURCE_COLUMN],
|
412 |
+
name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null,
|
413 |
+
};
|
414 |
+
};
|
415 |
+
generatedPositionFor = (map, { source, line, column, bias }) => {
|
416 |
+
line--;
|
417 |
+
if (line < 0)
|
418 |
+
throw new Error(LINE_GTR_ZERO);
|
419 |
+
if (column < 0)
|
420 |
+
throw new Error(COL_GTR_EQ_ZERO);
|
421 |
+
const { sources, resolvedSources } = map;
|
422 |
+
let sourceIndex = sources.indexOf(source);
|
423 |
+
if (sourceIndex === -1)
|
424 |
+
sourceIndex = resolvedSources.indexOf(source);
|
425 |
+
if (sourceIndex === -1)
|
426 |
+
return INVALID_GENERATED_MAPPING;
|
427 |
+
const generated = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
|
428 |
+
const memos = map._bySourceMemos;
|
429 |
+
const segments = generated[sourceIndex][line];
|
430 |
+
if (segments == null)
|
431 |
+
return INVALID_GENERATED_MAPPING;
|
432 |
+
const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND);
|
433 |
+
if (segment == null)
|
434 |
+
return INVALID_GENERATED_MAPPING;
|
435 |
+
return {
|
436 |
+
line: segment[REV_GENERATED_LINE] + 1,
|
437 |
+
column: segment[REV_GENERATED_COLUMN],
|
438 |
+
};
|
439 |
+
};
|
440 |
+
eachMapping = (map, cb) => {
|
441 |
+
const decoded = decodedMappings(map);
|
442 |
+
const { names, resolvedSources } = map;
|
443 |
+
for (let i = 0; i < decoded.length; i++) {
|
444 |
+
const line = decoded[i];
|
445 |
+
for (let j = 0; j < line.length; j++) {
|
446 |
+
const seg = line[j];
|
447 |
+
const generatedLine = i + 1;
|
448 |
+
const generatedColumn = seg[0];
|
449 |
+
let source = null;
|
450 |
+
let originalLine = null;
|
451 |
+
let originalColumn = null;
|
452 |
+
let name = null;
|
453 |
+
if (seg.length !== 1) {
|
454 |
+
source = resolvedSources[seg[1]];
|
455 |
+
originalLine = seg[2] + 1;
|
456 |
+
originalColumn = seg[3];
|
457 |
+
}
|
458 |
+
if (seg.length === 5)
|
459 |
+
name = names[seg[4]];
|
460 |
+
cb({
|
461 |
+
generatedLine,
|
462 |
+
generatedColumn,
|
463 |
+
source,
|
464 |
+
originalLine,
|
465 |
+
originalColumn,
|
466 |
+
name,
|
467 |
+
});
|
468 |
+
}
|
469 |
+
}
|
470 |
+
};
|
471 |
+
presortedDecodedMap = (map, mapUrl) => {
|
472 |
+
const clone = Object.assign({}, map);
|
473 |
+
clone.mappings = [];
|
474 |
+
const tracer = new TraceMap(clone, mapUrl);
|
475 |
+
tracer._decoded = map.mappings;
|
476 |
+
return tracer;
|
477 |
+
};
|
478 |
+
decodedMap = (map) => {
|
479 |
+
return {
|
480 |
+
version: 3,
|
481 |
+
file: map.file,
|
482 |
+
names: map.names,
|
483 |
+
sourceRoot: map.sourceRoot,
|
484 |
+
sources: map.sources,
|
485 |
+
sourcesContent: map.sourcesContent,
|
486 |
+
mappings: decodedMappings(map),
|
487 |
+
};
|
488 |
+
};
|
489 |
+
encodedMap = (map) => {
|
490 |
+
return {
|
491 |
+
version: 3,
|
492 |
+
file: map.file,
|
493 |
+
names: map.names,
|
494 |
+
sourceRoot: map.sourceRoot,
|
495 |
+
sources: map.sources,
|
496 |
+
sourcesContent: map.sourcesContent,
|
497 |
+
mappings: encodedMappings(map),
|
498 |
+
};
|
499 |
+
};
|
500 |
+
})();
|
501 |
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
502 |
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
503 |
+
if (found) {
|
504 |
+
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
505 |
+
}
|
506 |
+
else if (bias === LEAST_UPPER_BOUND)
|
507 |
+
index++;
|
508 |
+
if (index === -1 || index === segments.length)
|
509 |
+
return null;
|
510 |
+
return segments[index];
|
511 |
+
}
|
512 |
+
|
513 |
+
export { AnyMap, GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap, decodedMap, decodedMappings, eachMapping, encodedMap, encodedMappings, generatedPositionFor, originalPositionFor, presortedDecodedMap, traceSegment };
|
514 |
+
//# sourceMappingURL=trace-mapping.mjs.map
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"trace-mapping.mjs","sources":["../../src/resolve.ts","../../src/strip-filename.ts","../../src/sourcemap-segment.ts","../../src/sort.ts","../../src/binary-search.ts","../../src/by-source.ts","../../src/any-map.ts","../../src/trace-mapping.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["bsFound"],"mappings":";;;SAEwB,OAAO,CAAC,KAAa,EAAE,IAAwB;;;;IAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,IAAI,IAAI,GAAG,CAAC;IAE7C,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC;;ACTA;;;SAGwB,aAAa,CAAC,IAA+B;IACnE,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AAClC;;ACQO,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,oBAAoB,GAAG,CAAC;;SClBb,SAAS,CAC/B,QAA8B,EAC9B,KAAc;IAEd,MAAM,aAAa,GAAG,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3D,IAAI,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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (global, factory) {
|
2 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/sourcemap-codec'), require('@jridgewell/resolve-uri')) :
|
3 |
+
typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/sourcemap-codec', '@jridgewell/resolve-uri'], factory) :
|
4 |
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI));
|
5 |
+
})(this, (function (exports, sourcemapCodec, resolveUri) { 'use strict';
|
6 |
+
|
7 |
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8 |
+
|
9 |
+
var resolveUri__default = /*#__PURE__*/_interopDefaultLegacy(resolveUri);
|
10 |
+
|
11 |
+
function resolve(input, base) {
|
12 |
+
// The base is always treated as a directory, if it's not empty.
|
13 |
+
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
14 |
+
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
15 |
+
if (base && !base.endsWith('/'))
|
16 |
+
base += '/';
|
17 |
+
return resolveUri__default["default"](input, base);
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Removes everything after the last "/", but leaves the slash.
|
22 |
+
*/
|
23 |
+
function stripFilename(path) {
|
24 |
+
if (!path)
|
25 |
+
return '';
|
26 |
+
const index = path.lastIndexOf('/');
|
27 |
+
return path.slice(0, index + 1);
|
28 |
+
}
|
29 |
+
|
30 |
+
const COLUMN = 0;
|
31 |
+
const SOURCES_INDEX = 1;
|
32 |
+
const SOURCE_LINE = 2;
|
33 |
+
const SOURCE_COLUMN = 3;
|
34 |
+
const NAMES_INDEX = 4;
|
35 |
+
const REV_GENERATED_LINE = 1;
|
36 |
+
const REV_GENERATED_COLUMN = 2;
|
37 |
+
|
38 |
+
function maybeSort(mappings, owned) {
|
39 |
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
40 |
+
if (unsortedIndex === mappings.length)
|
41 |
+
return mappings;
|
42 |
+
// If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
|
43 |
+
// not, we do not want to modify the consumer's input array.
|
44 |
+
if (!owned)
|
45 |
+
mappings = mappings.slice();
|
46 |
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
47 |
+
mappings[i] = sortSegments(mappings[i], owned);
|
48 |
+
}
|
49 |
+
return mappings;
|
50 |
+
}
|
51 |
+
function nextUnsortedSegmentLine(mappings, start) {
|
52 |
+
for (let i = start; i < mappings.length; i++) {
|
53 |
+
if (!isSorted(mappings[i]))
|
54 |
+
return i;
|
55 |
+
}
|
56 |
+
return mappings.length;
|
57 |
+
}
|
58 |
+
function isSorted(line) {
|
59 |
+
for (let j = 1; j < line.length; j++) {
|
60 |
+
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return true;
|
65 |
+
}
|
66 |
+
function sortSegments(line, owned) {
|
67 |
+
if (!owned)
|
68 |
+
line = line.slice();
|
69 |
+
return line.sort(sortComparator);
|
70 |
+
}
|
71 |
+
function sortComparator(a, b) {
|
72 |
+
return a[COLUMN] - b[COLUMN];
|
73 |
+
}
|
74 |
+
|
75 |
+
let found = false;
|
76 |
+
/**
|
77 |
+
* A binary search implementation that returns the index if a match is found.
|
78 |
+
* If no match is found, then the left-index (the index associated with the item that comes just
|
79 |
+
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
80 |
+
* the next index:
|
81 |
+
*
|
82 |
+
* ```js
|
83 |
+
* const array = [1, 3];
|
84 |
+
* const needle = 2;
|
85 |
+
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
86 |
+
*
|
87 |
+
* assert.equal(index, 0);
|
88 |
+
* array.splice(index + 1, 0, needle);
|
89 |
+
* assert.deepEqual(array, [1, 2, 3]);
|
90 |
+
* ```
|
91 |
+
*/
|
92 |
+
function binarySearch(haystack, needle, low, high) {
|
93 |
+
while (low <= high) {
|
94 |
+
const mid = low + ((high - low) >> 1);
|
95 |
+
const cmp = haystack[mid][COLUMN] - needle;
|
96 |
+
if (cmp === 0) {
|
97 |
+
found = true;
|
98 |
+
return mid;
|
99 |
+
}
|
100 |
+
if (cmp < 0) {
|
101 |
+
low = mid + 1;
|
102 |
+
}
|
103 |
+
else {
|
104 |
+
high = mid - 1;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
found = false;
|
108 |
+
return low - 1;
|
109 |
+
}
|
110 |
+
function upperBound(haystack, needle, index) {
|
111 |
+
for (let i = index + 1; i < haystack.length; i++, index++) {
|
112 |
+
if (haystack[i][COLUMN] !== needle)
|
113 |
+
break;
|
114 |
+
}
|
115 |
+
return index;
|
116 |
+
}
|
117 |
+
function lowerBound(haystack, needle, index) {
|
118 |
+
for (let i = index - 1; i >= 0; i--, index--) {
|
119 |
+
if (haystack[i][COLUMN] !== needle)
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
return index;
|
123 |
+
}
|
124 |
+
function memoizedState() {
|
125 |
+
return {
|
126 |
+
lastKey: -1,
|
127 |
+
lastNeedle: -1,
|
128 |
+
lastIndex: -1,
|
129 |
+
};
|
130 |
+
}
|
131 |
+
/**
|
132 |
+
* This overly complicated beast is just to record the last tested line/column and the resulting
|
133 |
+
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
134 |
+
*/
|
135 |
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
136 |
+
const { lastKey, lastNeedle, lastIndex } = state;
|
137 |
+
let low = 0;
|
138 |
+
let high = haystack.length - 1;
|
139 |
+
if (key === lastKey) {
|
140 |
+
if (needle === lastNeedle) {
|
141 |
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
142 |
+
return lastIndex;
|
143 |
+
}
|
144 |
+
if (needle >= lastNeedle) {
|
145 |
+
// lastIndex may be -1 if the previous needle was not found.
|
146 |
+
low = lastIndex === -1 ? 0 : lastIndex;
|
147 |
+
}
|
148 |
+
else {
|
149 |
+
high = lastIndex;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
state.lastKey = key;
|
153 |
+
state.lastNeedle = needle;
|
154 |
+
return (state.lastIndex = binarySearch(haystack, needle, low, high));
|
155 |
+
}
|
156 |
+
|
157 |
+
// Rebuilds the original source files, with mappings that are ordered by source line/column instead
|
158 |
+
// of generated line/column.
|
159 |
+
function buildBySources(decoded, memos) {
|
160 |
+
const sources = memos.map(buildNullArray);
|
161 |
+
for (let i = 0; i < decoded.length; i++) {
|
162 |
+
const line = decoded[i];
|
163 |
+
for (let j = 0; j < line.length; j++) {
|
164 |
+
const seg = line[j];
|
165 |
+
if (seg.length === 1)
|
166 |
+
continue;
|
167 |
+
const sourceIndex = seg[SOURCES_INDEX];
|
168 |
+
const sourceLine = seg[SOURCE_LINE];
|
169 |
+
const sourceColumn = seg[SOURCE_COLUMN];
|
170 |
+
const originalSource = sources[sourceIndex];
|
171 |
+
const originalLine = (originalSource[sourceLine] || (originalSource[sourceLine] = []));
|
172 |
+
const memo = memos[sourceIndex];
|
173 |
+
// The binary search either found a match, or it found the left-index just before where the
|
174 |
+
// segment should go. Either way, we want to insert after that. And there may be multiple
|
175 |
+
// generated segments associated with an original location, so there may need to move several
|
176 |
+
// indexes before we find where we need to insert.
|
177 |
+
const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine));
|
178 |
+
insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
return sources;
|
182 |
+
}
|
183 |
+
function insert(array, index, value) {
|
184 |
+
for (let i = array.length; i > index; i--) {
|
185 |
+
array[i] = array[i - 1];
|
186 |
+
}
|
187 |
+
array[index] = value;
|
188 |
+
}
|
189 |
+
// Null arrays allow us to use ordered index keys without actually allocating contiguous memory like
|
190 |
+
// a real array. We use a null-prototype object to avoid prototype pollution and deoptimizations.
|
191 |
+
// Numeric properties on objects are magically sorted in ascending order by the engine regardless of
|
192 |
+
// the insertion order. So, by setting any numeric keys, even out of order, we'll get ascending
|
193 |
+
// order when iterating with for-in.
|
194 |
+
function buildNullArray() {
|
195 |
+
return { __proto__: null };
|
196 |
+
}
|
197 |
+
|
198 |
+
const AnyMap = function (map, mapUrl) {
|
199 |
+
const parsed = typeof map === 'string' ? JSON.parse(map) : map;
|
200 |
+
if (!('sections' in parsed))
|
201 |
+
return new TraceMap(parsed, mapUrl);
|
202 |
+
const mappings = [];
|
203 |
+
const sources = [];
|
204 |
+
const sourcesContent = [];
|
205 |
+
const names = [];
|
206 |
+
const { sections } = parsed;
|
207 |
+
let i = 0;
|
208 |
+
for (; i < sections.length - 1; i++) {
|
209 |
+
const no = sections[i + 1].offset;
|
210 |
+
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, no.line, no.column);
|
211 |
+
}
|
212 |
+
if (sections.length > 0) {
|
213 |
+
addSection(sections[i], mapUrl, mappings, sources, sourcesContent, names, Infinity, Infinity);
|
214 |
+
}
|
215 |
+
const joined = {
|
216 |
+
version: 3,
|
217 |
+
file: parsed.file,
|
218 |
+
names,
|
219 |
+
sources,
|
220 |
+
sourcesContent,
|
221 |
+
mappings,
|
222 |
+
};
|
223 |
+
return exports.presortedDecodedMap(joined);
|
224 |
+
};
|
225 |
+
function addSection(section, mapUrl, mappings, sources, sourcesContent, names, stopLine, stopColumn) {
|
226 |
+
const map = AnyMap(section.map, mapUrl);
|
227 |
+
const { line: lineOffset, column: columnOffset } = section.offset;
|
228 |
+
const sourcesOffset = sources.length;
|
229 |
+
const namesOffset = names.length;
|
230 |
+
const decoded = exports.decodedMappings(map);
|
231 |
+
const { resolvedSources } = map;
|
232 |
+
append(sources, resolvedSources);
|
233 |
+
append(sourcesContent, map.sourcesContent || fillSourcesContent(resolvedSources.length));
|
234 |
+
append(names, map.names);
|
235 |
+
// If this section jumps forwards several lines, we need to add lines to the output mappings catch up.
|
236 |
+
for (let i = mappings.length; i <= lineOffset; i++)
|
237 |
+
mappings.push([]);
|
238 |
+
// We can only add so many lines before we step into the range that the next section's map
|
239 |
+
// controls. When we get to the last line, then we'll start checking the segments to see if
|
240 |
+
// they've crossed into the column range.
|
241 |
+
const stopI = stopLine - lineOffset;
|
242 |
+
const len = Math.min(decoded.length, stopI + 1);
|
243 |
+
for (let i = 0; i < len; i++) {
|
244 |
+
const line = decoded[i];
|
245 |
+
// On the 0th loop, the line will already exist due to a previous section, or the line catch up
|
246 |
+
// loop above.
|
247 |
+
const out = i === 0 ? mappings[lineOffset] : (mappings[lineOffset + i] = []);
|
248 |
+
// On the 0th loop, the section's column offset shifts us forward. On all other lines (since the
|
249 |
+
// map can be multiple lines), it doesn't.
|
250 |
+
const cOffset = i === 0 ? columnOffset : 0;
|
251 |
+
for (let j = 0; j < line.length; j++) {
|
252 |
+
const seg = line[j];
|
253 |
+
const column = cOffset + seg[COLUMN];
|
254 |
+
// If this segment steps into the column range that the next section's map controls, we need
|
255 |
+
// to stop early.
|
256 |
+
if (i === stopI && column >= stopColumn)
|
257 |
+
break;
|
258 |
+
if (seg.length === 1) {
|
259 |
+
out.push([column]);
|
260 |
+
continue;
|
261 |
+
}
|
262 |
+
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
|
263 |
+
const sourceLine = seg[SOURCE_LINE];
|
264 |
+
const sourceColumn = seg[SOURCE_COLUMN];
|
265 |
+
if (seg.length === 4) {
|
266 |
+
out.push([column, sourcesIndex, sourceLine, sourceColumn]);
|
267 |
+
continue;
|
268 |
+
}
|
269 |
+
out.push([column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
}
|
273 |
+
function append(arr, other) {
|
274 |
+
for (let i = 0; i < other.length; i++)
|
275 |
+
arr.push(other[i]);
|
276 |
+
}
|
277 |
+
// Sourcemaps don't need to have sourcesContent, and if they don't, we need to create an array of
|
278 |
+
// equal length to the sources. This is because the sources and sourcesContent are paired arrays,
|
279 |
+
// where `sourcesContent[i]` is the content of the `sources[i]` file. If we didn't, then joined
|
280 |
+
// sourcemap would desynchronize the sources/contents.
|
281 |
+
function fillSourcesContent(len) {
|
282 |
+
const sourcesContent = [];
|
283 |
+
for (let i = 0; i < len; i++)
|
284 |
+
sourcesContent[i] = null;
|
285 |
+
return sourcesContent;
|
286 |
+
}
|
287 |
+
|
288 |
+
const INVALID_ORIGINAL_MAPPING = Object.freeze({
|
289 |
+
source: null,
|
290 |
+
line: null,
|
291 |
+
column: null,
|
292 |
+
name: null,
|
293 |
+
});
|
294 |
+
const INVALID_GENERATED_MAPPING = Object.freeze({
|
295 |
+
line: null,
|
296 |
+
column: null,
|
297 |
+
});
|
298 |
+
const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
|
299 |
+
const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
|
300 |
+
const LEAST_UPPER_BOUND = -1;
|
301 |
+
const GREATEST_LOWER_BOUND = 1;
|
302 |
+
/**
|
303 |
+
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
304 |
+
*/
|
305 |
+
exports.encodedMappings = void 0;
|
306 |
+
/**
|
307 |
+
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
308 |
+
*/
|
309 |
+
exports.decodedMappings = void 0;
|
310 |
+
/**
|
311 |
+
* A low-level API to find the segment associated with a generated line/column (think, from a
|
312 |
+
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
313 |
+
*/
|
314 |
+
exports.traceSegment = void 0;
|
315 |
+
/**
|
316 |
+
* A higher-level API to find the source/line/column associated with a generated line/column
|
317 |
+
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
318 |
+
* `source-map` library.
|
319 |
+
*/
|
320 |
+
exports.originalPositionFor = void 0;
|
321 |
+
/**
|
322 |
+
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
323 |
+
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
324 |
+
*
|
325 |
+
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
326 |
+
* using the same needle that would return `id` when calling `originalPositionFor`.
|
327 |
+
*/
|
328 |
+
exports.generatedPositionFor = void 0;
|
329 |
+
/**
|
330 |
+
* Iterates each mapping in generated position order.
|
331 |
+
*/
|
332 |
+
exports.eachMapping = void 0;
|
333 |
+
/**
|
334 |
+
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
335 |
+
* maps.
|
336 |
+
*/
|
337 |
+
exports.presortedDecodedMap = void 0;
|
338 |
+
/**
|
339 |
+
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
340 |
+
* a sourcemap, or to JSON.stringify.
|
341 |
+
*/
|
342 |
+
exports.decodedMap = void 0;
|
343 |
+
/**
|
344 |
+
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
345 |
+
* a sourcemap, or to JSON.stringify.
|
346 |
+
*/
|
347 |
+
exports.encodedMap = void 0;
|
348 |
+
class TraceMap {
|
349 |
+
constructor(map, mapUrl) {
|
350 |
+
this._decodedMemo = memoizedState();
|
351 |
+
this._bySources = undefined;
|
352 |
+
this._bySourceMemos = undefined;
|
353 |
+
const isString = typeof map === 'string';
|
354 |
+
if (!isString && map.constructor === TraceMap)
|
355 |
+
return map;
|
356 |
+
const parsed = (isString ? JSON.parse(map) : map);
|
357 |
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
358 |
+
this.version = version;
|
359 |
+
this.file = file;
|
360 |
+
this.names = names;
|
361 |
+
this.sourceRoot = sourceRoot;
|
362 |
+
this.sources = sources;
|
363 |
+
this.sourcesContent = sourcesContent;
|
364 |
+
if (sourceRoot || mapUrl) {
|
365 |
+
const from = resolve(sourceRoot || '', stripFilename(mapUrl));
|
366 |
+
this.resolvedSources = sources.map((s) => resolve(s || '', from));
|
367 |
+
}
|
368 |
+
else {
|
369 |
+
this.resolvedSources = sources.map((s) => s || '');
|
370 |
+
}
|
371 |
+
const { mappings } = parsed;
|
372 |
+
if (typeof mappings === 'string') {
|
373 |
+
this._encoded = mappings;
|
374 |
+
this._decoded = undefined;
|
375 |
+
}
|
376 |
+
else {
|
377 |
+
this._encoded = undefined;
|
378 |
+
this._decoded = maybeSort(mappings, isString);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
(() => {
|
383 |
+
exports.encodedMappings = (map) => {
|
384 |
+
var _a;
|
385 |
+
return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = sourcemapCodec.encode(map._decoded)));
|
386 |
+
};
|
387 |
+
exports.decodedMappings = (map) => {
|
388 |
+
return (map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded)));
|
389 |
+
};
|
390 |
+
exports.traceSegment = (map, line, column) => {
|
391 |
+
const decoded = exports.decodedMappings(map);
|
392 |
+
// It's common for parent source maps to have pointers to lines that have no
|
393 |
+
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
394 |
+
if (line >= decoded.length)
|
395 |
+
return null;
|
396 |
+
return traceSegmentInternal(decoded[line], map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
397 |
+
};
|
398 |
+
exports.originalPositionFor = (map, { line, column, bias }) => {
|
399 |
+
line--;
|
400 |
+
if (line < 0)
|
401 |
+
throw new Error(LINE_GTR_ZERO);
|
402 |
+
if (column < 0)
|
403 |
+
throw new Error(COL_GTR_EQ_ZERO);
|
404 |
+
const decoded = exports.decodedMappings(map);
|
405 |
+
// It's common for parent source maps to have pointers to lines that have no
|
406 |
+
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
407 |
+
if (line >= decoded.length)
|
408 |
+
return INVALID_ORIGINAL_MAPPING;
|
409 |
+
const segment = traceSegmentInternal(decoded[line], map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
410 |
+
if (segment == null)
|
411 |
+
return INVALID_ORIGINAL_MAPPING;
|
412 |
+
if (segment.length == 1)
|
413 |
+
return INVALID_ORIGINAL_MAPPING;
|
414 |
+
const { names, resolvedSources } = map;
|
415 |
+
return {
|
416 |
+
source: resolvedSources[segment[SOURCES_INDEX]],
|
417 |
+
line: segment[SOURCE_LINE] + 1,
|
418 |
+
column: segment[SOURCE_COLUMN],
|
419 |
+
name: segment.length === 5 ? names[segment[NAMES_INDEX]] : null,
|
420 |
+
};
|
421 |
+
};
|
422 |
+
exports.generatedPositionFor = (map, { source, line, column, bias }) => {
|
423 |
+
line--;
|
424 |
+
if (line < 0)
|
425 |
+
throw new Error(LINE_GTR_ZERO);
|
426 |
+
if (column < 0)
|
427 |
+
throw new Error(COL_GTR_EQ_ZERO);
|
428 |
+
const { sources, resolvedSources } = map;
|
429 |
+
let sourceIndex = sources.indexOf(source);
|
430 |
+
if (sourceIndex === -1)
|
431 |
+
sourceIndex = resolvedSources.indexOf(source);
|
432 |
+
if (sourceIndex === -1)
|
433 |
+
return INVALID_GENERATED_MAPPING;
|
434 |
+
const generated = (map._bySources || (map._bySources = buildBySources(exports.decodedMappings(map), (map._bySourceMemos = sources.map(memoizedState)))));
|
435 |
+
const memos = map._bySourceMemos;
|
436 |
+
const segments = generated[sourceIndex][line];
|
437 |
+
if (segments == null)
|
438 |
+
return INVALID_GENERATED_MAPPING;
|
439 |
+
const segment = traceSegmentInternal(segments, memos[sourceIndex], line, column, bias || GREATEST_LOWER_BOUND);
|
440 |
+
if (segment == null)
|
441 |
+
return INVALID_GENERATED_MAPPING;
|
442 |
+
return {
|
443 |
+
line: segment[REV_GENERATED_LINE] + 1,
|
444 |
+
column: segment[REV_GENERATED_COLUMN],
|
445 |
+
};
|
446 |
+
};
|
447 |
+
exports.eachMapping = (map, cb) => {
|
448 |
+
const decoded = exports.decodedMappings(map);
|
449 |
+
const { names, resolvedSources } = map;
|
450 |
+
for (let i = 0; i < decoded.length; i++) {
|
451 |
+
const line = decoded[i];
|
452 |
+
for (let j = 0; j < line.length; j++) {
|
453 |
+
const seg = line[j];
|
454 |
+
const generatedLine = i + 1;
|
455 |
+
const generatedColumn = seg[0];
|
456 |
+
let source = null;
|
457 |
+
let originalLine = null;
|
458 |
+
let originalColumn = null;
|
459 |
+
let name = null;
|
460 |
+
if (seg.length !== 1) {
|
461 |
+
source = resolvedSources[seg[1]];
|
462 |
+
originalLine = seg[2] + 1;
|
463 |
+
originalColumn = seg[3];
|
464 |
+
}
|
465 |
+
if (seg.length === 5)
|
466 |
+
name = names[seg[4]];
|
467 |
+
cb({
|
468 |
+
generatedLine,
|
469 |
+
generatedColumn,
|
470 |
+
source,
|
471 |
+
originalLine,
|
472 |
+
originalColumn,
|
473 |
+
name,
|
474 |
+
});
|
475 |
+
}
|
476 |
+
}
|
477 |
+
};
|
478 |
+
exports.presortedDecodedMap = (map, mapUrl) => {
|
479 |
+
const clone = Object.assign({}, map);
|
480 |
+
clone.mappings = [];
|
481 |
+
const tracer = new TraceMap(clone, mapUrl);
|
482 |
+
tracer._decoded = map.mappings;
|
483 |
+
return tracer;
|
484 |
+
};
|
485 |
+
exports.decodedMap = (map) => {
|
486 |
+
return {
|
487 |
+
version: 3,
|
488 |
+
file: map.file,
|
489 |
+
names: map.names,
|
490 |
+
sourceRoot: map.sourceRoot,
|
491 |
+
sources: map.sources,
|
492 |
+
sourcesContent: map.sourcesContent,
|
493 |
+
mappings: exports.decodedMappings(map),
|
494 |
+
};
|
495 |
+
};
|
496 |
+
exports.encodedMap = (map) => {
|
497 |
+
return {
|
498 |
+
version: 3,
|
499 |
+
file: map.file,
|
500 |
+
names: map.names,
|
501 |
+
sourceRoot: map.sourceRoot,
|
502 |
+
sources: map.sources,
|
503 |
+
sourcesContent: map.sourcesContent,
|
504 |
+
mappings: exports.encodedMappings(map),
|
505 |
+
};
|
506 |
+
};
|
507 |
+
})();
|
508 |
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
509 |
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
510 |
+
if (found) {
|
511 |
+
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
512 |
+
}
|
513 |
+
else if (bias === LEAST_UPPER_BOUND)
|
514 |
+
index++;
|
515 |
+
if (index === -1 || index === segments.length)
|
516 |
+
return null;
|
517 |
+
return segments[index];
|
518 |
+
}
|
519 |
+
|
520 |
+
exports.AnyMap = AnyMap;
|
521 |
+
exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND;
|
522 |
+
exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND;
|
523 |
+
exports.TraceMap = TraceMap;
|
524 |
+
|
525 |
+
Object.defineProperty(exports, '__esModule', { value: true });
|
526 |
+
|
527 |
+
}));
|
528 |
+
//# sourceMappingURL=trace-mapping.umd.js.map
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"version":3,"file":"trace-mapping.umd.js","sources":["../../src/resolve.ts","../../src/strip-filename.ts","../../src/sourcemap-segment.ts","../../src/sort.ts","../../src/binary-search.ts","../../src/by-source.ts","../../src/any-map.ts","../../src/trace-mapping.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["resolveUri","presortedDecodedMap","decodedMappings","encodedMappings","traceSegment","originalPositionFor","generatedPositionFor","eachMapping","decodedMap","encodedMap","encode","decode","bsFound"],"mappings":";;;;;;;;;;aAEwB,OAAO,CAAC,KAAa,EAAE,IAAwB;;;;QAIrE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,IAAI,IAAI,GAAG,CAAC;QAE7C,OAAOA,8BAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjC;;ICTA;;;aAGwB,aAAa,CAAC,IAA+B;QACnE,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC;;ICQO,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IAEtB,MAAM,kBAAkB,GAAG,CAAC,CA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TraceMap } from './trace-mapping';
|
2 |
+
import type { SectionedSourceMapInput } from './types';
|
3 |
+
declare type AnyMap = {
|
4 |
+
new (map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;
|
5 |
+
(map: SectionedSourceMapInput, mapUrl?: string | null): TraceMap;
|
6 |
+
};
|
7 |
+
export declare const AnyMap: AnyMap;
|
8 |
+
export {};
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment';
|
2 |
+
export declare type MemoState = {
|
3 |
+
lastKey: number;
|
4 |
+
lastNeedle: number;
|
5 |
+
lastIndex: number;
|
6 |
+
};
|
7 |
+
export declare let found: boolean;
|
8 |
+
/**
|
9 |
+
* A binary search implementation that returns the index if a match is found.
|
10 |
+
* If no match is found, then the left-index (the index associated with the item that comes just
|
11 |
+
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
12 |
+
* the next index:
|
13 |
+
*
|
14 |
+
* ```js
|
15 |
+
* const array = [1, 3];
|
16 |
+
* const needle = 2;
|
17 |
+
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
18 |
+
*
|
19 |
+
* assert.equal(index, 0);
|
20 |
+
* array.splice(index + 1, 0, needle);
|
21 |
+
* assert.deepEqual(array, [1, 2, 3]);
|
22 |
+
* ```
|
23 |
+
*/
|
24 |
+
export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number;
|
25 |
+
export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number;
|
26 |
+
export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number;
|
27 |
+
export declare function memoizedState(): MemoState;
|
28 |
+
/**
|
29 |
+
* This overly complicated beast is just to record the last tested line/column and the resulting
|
30 |
+
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
31 |
+
*/
|
32 |
+
export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number;
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';
|
2 |
+
import type { MemoState } from './binary-search';
|
3 |
+
export declare type Source = {
|
4 |
+
__proto__: null;
|
5 |
+
[line: number]: Exclude<ReverseSegment, [number]>[];
|
6 |
+
};
|
7 |
+
export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[];
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export default function resolve(input: string, base: string | undefined): string;
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
import type { SourceMapSegment } from './sourcemap-segment';
|
2 |
+
export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][];
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
declare type GeneratedColumn = number;
|
2 |
+
declare type SourcesIndex = number;
|
3 |
+
declare type SourceLine = number;
|
4 |
+
declare type SourceColumn = number;
|
5 |
+
declare type NamesIndex = number;
|
6 |
+
declare type GeneratedLine = number;
|
7 |
+
export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
|
8 |
+
export declare type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn];
|
9 |
+
export declare const COLUMN = 0;
|
10 |
+
export declare const SOURCES_INDEX = 1;
|
11 |
+
export declare const SOURCE_LINE = 2;
|
12 |
+
export declare const SOURCE_COLUMN = 3;
|
13 |
+
export declare const NAMES_INDEX = 4;
|
14 |
+
export declare const REV_GENERATED_LINE = 1;
|
15 |
+
export declare const REV_GENERATED_COLUMN = 2;
|
16 |
+
export {};
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Removes everything after the last "/", but leaves the slash.
|
3 |
+
*/
|
4 |
+
export default function stripFilename(path: string | undefined | null): string;
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import type { SourceMapSegment } from './sourcemap-segment';
|
2 |
+
import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping } from './types';
|
3 |
+
export type { SourceMapSegment } from './sourcemap-segment';
|
4 |
+
export type { SourceMapInput, SectionedSourceMapInput, DecodedSourceMap, EncodedSourceMap, SectionedSourceMap, InvalidOriginalMapping, OriginalMapping as Mapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, EachMapping, } from './types';
|
5 |
+
export declare const LEAST_UPPER_BOUND = -1;
|
6 |
+
export declare const GREATEST_LOWER_BOUND = 1;
|
7 |
+
/**
|
8 |
+
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
9 |
+
*/
|
10 |
+
export declare let encodedMappings: (map: TraceMap) => EncodedSourceMap['mappings'];
|
11 |
+
/**
|
12 |
+
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
13 |
+
*/
|
14 |
+
export declare let decodedMappings: (map: TraceMap) => Readonly<DecodedSourceMap['mappings']>;
|
15 |
+
/**
|
16 |
+
* A low-level API to find the segment associated with a generated line/column (think, from a
|
17 |
+
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
18 |
+
*/
|
19 |
+
export declare let traceSegment: (map: TraceMap, line: number, column: number) => Readonly<SourceMapSegment> | null;
|
20 |
+
/**
|
21 |
+
* A higher-level API to find the source/line/column associated with a generated line/column
|
22 |
+
* (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
|
23 |
+
* `source-map` library.
|
24 |
+
*/
|
25 |
+
export declare let originalPositionFor: (map: TraceMap, needle: Needle) => OriginalMapping | InvalidOriginalMapping;
|
26 |
+
/**
|
27 |
+
* Finds the source/line/column directly after the mapping returned by originalPositionFor, provided
|
28 |
+
* the found mapping is from the same source and line as the originalPositionFor mapping.
|
29 |
+
*
|
30 |
+
* Eg, in the code `let id = 1`, `originalPositionAfter` could find the mapping associated with `1`
|
31 |
+
* using the same needle that would return `id` when calling `originalPositionFor`.
|
32 |
+
*/
|
33 |
+
export declare let generatedPositionFor: (map: TraceMap, needle: SourceNeedle) => GeneratedMapping | InvalidGeneratedMapping;
|
34 |
+
/**
|
35 |
+
* Iterates each mapping in generated position order.
|
36 |
+
*/
|
37 |
+
export declare let eachMapping: (map: TraceMap, cb: (mapping: EachMapping) => void) => void;
|
38 |
+
/**
|
39 |
+
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
40 |
+
* maps.
|
41 |
+
*/
|
42 |
+
export declare let presortedDecodedMap: (map: DecodedSourceMap, mapUrl?: string) => TraceMap;
|
43 |
+
/**
|
44 |
+
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
45 |
+
* a sourcemap, or to JSON.stringify.
|
46 |
+
*/
|
47 |
+
export declare let decodedMap: (map: TraceMap) => Omit<DecodedSourceMap, 'mappings'> & {
|
48 |
+
mappings: readonly SourceMapSegment[][];
|
49 |
+
};
|
50 |
+
/**
|
51 |
+
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
52 |
+
* a sourcemap, or to JSON.stringify.
|
53 |
+
*/
|
54 |
+
export declare let encodedMap: (map: TraceMap) => EncodedSourceMap;
|
55 |
+
export { AnyMap } from './any-map';
|
56 |
+
export declare class TraceMap implements SourceMap {
|
57 |
+
version: SourceMapV3['version'];
|
58 |
+
file: SourceMapV3['file'];
|
59 |
+
names: SourceMapV3['names'];
|
60 |
+
sourceRoot: SourceMapV3['sourceRoot'];
|
61 |
+
sources: SourceMapV3['sources'];
|
62 |
+
sourcesContent: SourceMapV3['sourcesContent'];
|
63 |
+
resolvedSources: string[];
|
64 |
+
private _encoded;
|
65 |
+
private _decoded;
|
66 |
+
private _decodedMemo;
|
67 |
+
private _bySources;
|
68 |
+
private _bySourceMemos;
|
69 |
+
constructor(map: SourceMapInput, mapUrl?: string | null);
|
70 |
+
}
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import type { SourceMapSegment } from './sourcemap-segment';
|
2 |
+
import type { TraceMap } from './trace-mapping';
|
3 |
+
export interface SourceMapV3 {
|
4 |
+
file?: string | null;
|
5 |
+
names: string[];
|
6 |
+
sourceRoot?: string;
|
7 |
+
sources: (string | null)[];
|
8 |
+
sourcesContent?: (string | null)[];
|
9 |
+
version: 3;
|
10 |
+
}
|
11 |
+
export interface EncodedSourceMap extends SourceMapV3 {
|
12 |
+
mappings: string;
|
13 |
+
}
|
14 |
+
export interface DecodedSourceMap extends SourceMapV3 {
|
15 |
+
mappings: SourceMapSegment[][];
|
16 |
+
}
|
17 |
+
export interface Section {
|
18 |
+
offset: {
|
19 |
+
line: number;
|
20 |
+
column: number;
|
21 |
+
};
|
22 |
+
map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap;
|
23 |
+
}
|
24 |
+
export interface SectionedSourceMap {
|
25 |
+
file?: string | null;
|
26 |
+
sections: Section[];
|
27 |
+
version: 3;
|
28 |
+
}
|
29 |
+
export declare type OriginalMapping = {
|
30 |
+
source: string | null;
|
31 |
+
line: number;
|
32 |
+
column: number;
|
33 |
+
name: string | null;
|
34 |
+
};
|
35 |
+
export declare type InvalidOriginalMapping = {
|
36 |
+
source: null;
|
37 |
+
line: null;
|
38 |
+
column: null;
|
39 |
+
name: null;
|
40 |
+
};
|
41 |
+
export declare type GeneratedMapping = {
|
42 |
+
line: number;
|
43 |
+
column: number;
|
44 |
+
};
|
45 |
+
export declare type InvalidGeneratedMapping = {
|
46 |
+
line: null;
|
47 |
+
column: null;
|
48 |
+
};
|
49 |
+
export declare type SourceMapInput = string | EncodedSourceMap | DecodedSourceMap | TraceMap;
|
50 |
+
export declare type SectionedSourceMapInput = SourceMapInput | SectionedSourceMap;
|
51 |
+
export declare type Needle = {
|
52 |
+
line: number;
|
53 |
+
column: number;
|
54 |
+
bias?: 1 | -1;
|
55 |
+
};
|
56 |
+
export declare type SourceNeedle = {
|
57 |
+
source: string;
|
58 |
+
line: number;
|
59 |
+
column: number;
|
60 |
+
bias?: 1 | -1;
|
61 |
+
};
|
62 |
+
export declare type EachMapping = {
|
63 |
+
generatedLine: number;
|
64 |
+
generatedColumn: number;
|
65 |
+
source: null;
|
66 |
+
originalLine: null;
|
67 |
+
originalColumn: null;
|
68 |
+
name: null;
|
69 |
+
} | {
|
70 |
+
generatedLine: number;
|
71 |
+
generatedColumn: number;
|
72 |
+
source: string | null;
|
73 |
+
originalLine: number;
|
74 |
+
originalColumn: number;
|
75 |
+
name: string | null;
|
76 |
+
};
|
77 |
+
export declare abstract class SourceMap {
|
78 |
+
version: SourceMapV3['version'];
|
79 |
+
file: SourceMapV3['file'];
|
80 |
+
names: SourceMapV3['names'];
|
81 |
+
sourceRoot: SourceMapV3['sourceRoot'];
|
82 |
+
sources: SourceMapV3['sources'];
|
83 |
+
sourcesContent: SourceMapV3['sourcesContent'];
|
84 |
+
resolvedSources: SourceMapV3['sources'];
|
85 |
+
}
|
workers1/auto3d/node_modules/@jridgewell/trace-mapping/package.json
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@jridgewell/trace-mapping",
|
3 |
+
"version": "0.3.9",
|
4 |
+
"description": "Trace the original position through a source map",
|
5 |
+
"keywords": [
|
6 |
+
"source",
|
7 |
+
"map"
|
8 |
+
],
|
9 |
+
"main": "dist/trace-mapping.umd.js",
|
10 |
+
"module": "dist/trace-mapping.mjs",
|
11 |
+
"typings": "dist/types/trace-mapping.d.ts",
|
12 |
+
"files": [
|
13 |
+
"dist"
|
14 |
+
],
|
15 |
+
"exports": {
|
16 |
+
".": {
|
17 |
+
"browser": "./dist/trace-mapping.umd.js",
|
18 |
+
"require": "./dist/trace-mapping.umd.js",
|
19 |
+
"import": "./dist/trace-mapping.mjs"
|
20 |
+
},
|
21 |
+
"./package.json": "./package.json"
|
22 |
+
},
|
23 |
+
"author": "Justin Ridgewell <[email protected]>",
|
24 |
+
"repository": {
|
25 |
+
"type": "git",
|
26 |
+
"url": "git+https://github.com/jridgewell/trace-mapping.git"
|
27 |
+
},
|
28 |
+
"license": "MIT",
|
29 |
+
"scripts": {
|
30 |
+
"benchmark": "run-s build:rollup benchmark:*",
|
31 |
+
"benchmark:install": "cd benchmark && npm install",
|
32 |
+
"benchmark:only": "node benchmark/index.mjs",
|
33 |
+
"build": "run-s -n build:*",
|
34 |
+
"build:rollup": "rollup -c rollup.config.js",
|
35 |
+
"build:ts": "tsc --project tsconfig.build.json",
|
36 |
+
"lint": "run-s -n lint:*",
|
37 |
+
"lint:prettier": "npm run test:lint:prettier -- --write",
|
38 |
+
"lint:ts": "npm run test:lint:ts -- --fix",
|
39 |
+
"prebuild": "rm -rf dist",
|
40 |
+
"prepublishOnly": "npm run preversion",
|
41 |
+
"preversion": "run-s test build",
|
42 |
+
"test": "run-s -n test:lint test:only",
|
43 |
+
"test:debug": "ava debug",
|
44 |
+
"test:lint": "run-s -n test:lint:*",
|
45 |
+
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'",
|
46 |
+
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
47 |
+
"test:only": "c8 ava",
|
48 |
+
"test:watch": "ava --watch"
|
49 |
+
},
|
50 |
+
"devDependencies": {
|
51 |
+
"@rollup/plugin-typescript": "8.3.0",
|
52 |
+
"@typescript-eslint/eslint-plugin": "5.10.0",
|
53 |
+
"@typescript-eslint/parser": "5.10.0",
|
54 |
+
"ava": "4.0.1",
|
55 |
+
"benchmark": "2.1.4",
|
56 |
+
"c8": "7.11.0",
|
57 |
+
"esbuild": "0.14.14",
|
58 |
+
"esbuild-node-loader": "0.6.4",
|
59 |
+
"eslint": "8.7.0",
|
60 |
+
"eslint-config-prettier": "8.3.0",
|
61 |
+
"npm-run-all": "4.1.5",
|
62 |
+
"prettier": "2.5.1",
|
63 |
+
"rollup": "2.64.0",
|
64 |
+
"typescript": "4.5.4"
|
65 |
+
},
|
66 |
+
"dependencies": {
|
67 |
+
"@jridgewell/resolve-uri": "^3.0.3",
|
68 |
+
"@jridgewell/sourcemap-codec": "^1.4.10"
|
69 |
+
}
|
70 |
+
}
|
workers1/auto3d/node_modules/@types/node/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) Microsoft Corporation.
|
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
|
workers1/auto3d/node_modules/@types/node/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/node`
|
3 |
+
|
4 |
+
# Summary
|
5 |
+
This package contains type definitions for node (https://nodejs.org/).
|
6 |
+
|
7 |
+
# Details
|
8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Wed, 04 Sep 2024 21:35:57 GMT
|
12 |
+
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
|
workers1/auto3d/node_modules/@types/node/assert.d.ts
ADDED
@@ -0,0 +1,1040 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:assert` module provides a set of assertion functions for verifying
|
3 |
+
* invariants.
|
4 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert.js)
|
5 |
+
*/
|
6 |
+
declare module "assert" {
|
7 |
+
/**
|
8 |
+
* An alias of {@link ok}.
|
9 |
+
* @since v0.5.9
|
10 |
+
* @param value The input that is checked for being truthy.
|
11 |
+
*/
|
12 |
+
function assert(value: unknown, message?: string | Error): asserts value;
|
13 |
+
namespace assert {
|
14 |
+
/**
|
15 |
+
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
16 |
+
*/
|
17 |
+
class AssertionError extends Error {
|
18 |
+
/**
|
19 |
+
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
20 |
+
*/
|
21 |
+
actual: unknown;
|
22 |
+
/**
|
23 |
+
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
24 |
+
*/
|
25 |
+
expected: unknown;
|
26 |
+
/**
|
27 |
+
* Set to the passed in operator value.
|
28 |
+
*/
|
29 |
+
operator: string;
|
30 |
+
/**
|
31 |
+
* Indicates if the message was auto-generated (`true`) or not.
|
32 |
+
*/
|
33 |
+
generatedMessage: boolean;
|
34 |
+
/**
|
35 |
+
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
36 |
+
*/
|
37 |
+
code: "ERR_ASSERTION";
|
38 |
+
constructor(options?: {
|
39 |
+
/** If provided, the error message is set to this value. */
|
40 |
+
message?: string | undefined;
|
41 |
+
/** The `actual` property on the error instance. */
|
42 |
+
actual?: unknown | undefined;
|
43 |
+
/** The `expected` property on the error instance. */
|
44 |
+
expected?: unknown | undefined;
|
45 |
+
/** The `operator` property on the error instance. */
|
46 |
+
operator?: string | undefined;
|
47 |
+
/** If provided, the generated stack trace omits frames before this function. */
|
48 |
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
49 |
+
stackStartFn?: Function | undefined;
|
50 |
+
});
|
51 |
+
}
|
52 |
+
/**
|
53 |
+
* This feature is deprecated and will be removed in a future version.
|
54 |
+
* Please consider using alternatives such as the `mock` helper function.
|
55 |
+
* @since v14.2.0, v12.19.0
|
56 |
+
* @deprecated Deprecated
|
57 |
+
*/
|
58 |
+
class CallTracker {
|
59 |
+
/**
|
60 |
+
* The wrapper function is expected to be called exactly `exact` times. If the
|
61 |
+
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
62 |
+
* error.
|
63 |
+
*
|
64 |
+
* ```js
|
65 |
+
* import assert from 'node:assert';
|
66 |
+
*
|
67 |
+
* // Creates call tracker.
|
68 |
+
* const tracker = new assert.CallTracker();
|
69 |
+
*
|
70 |
+
* function func() {}
|
71 |
+
*
|
72 |
+
* // Returns a function that wraps func() that must be called exact times
|
73 |
+
* // before tracker.verify().
|
74 |
+
* const callsfunc = tracker.calls(func);
|
75 |
+
* ```
|
76 |
+
* @since v14.2.0, v12.19.0
|
77 |
+
* @param [fn='A no-op function']
|
78 |
+
* @param [exact=1]
|
79 |
+
* @return A function that wraps `fn`.
|
80 |
+
*/
|
81 |
+
calls(exact?: number): () => void;
|
82 |
+
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
83 |
+
/**
|
84 |
+
* Example:
|
85 |
+
*
|
86 |
+
* ```js
|
87 |
+
* import assert from 'node:assert';
|
88 |
+
*
|
89 |
+
* const tracker = new assert.CallTracker();
|
90 |
+
*
|
91 |
+
* function func() {}
|
92 |
+
* const callsfunc = tracker.calls(func);
|
93 |
+
* callsfunc(1, 2, 3);
|
94 |
+
*
|
95 |
+
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
|
96 |
+
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
|
97 |
+
* ```
|
98 |
+
* @since v18.8.0, v16.18.0
|
99 |
+
* @return An array with all the calls to a tracked function.
|
100 |
+
*/
|
101 |
+
getCalls(fn: Function): CallTrackerCall[];
|
102 |
+
/**
|
103 |
+
* The arrays contains information about the expected and actual number of calls of
|
104 |
+
* the functions that have not been called the expected number of times.
|
105 |
+
*
|
106 |
+
* ```js
|
107 |
+
* import assert from 'node:assert';
|
108 |
+
*
|
109 |
+
* // Creates call tracker.
|
110 |
+
* const tracker = new assert.CallTracker();
|
111 |
+
*
|
112 |
+
* function func() {}
|
113 |
+
*
|
114 |
+
* // Returns a function that wraps func() that must be called exact times
|
115 |
+
* // before tracker.verify().
|
116 |
+
* const callsfunc = tracker.calls(func, 2);
|
117 |
+
*
|
118 |
+
* // Returns an array containing information on callsfunc()
|
119 |
+
* console.log(tracker.report());
|
120 |
+
* // [
|
121 |
+
* // {
|
122 |
+
* // message: 'Expected the func function to be executed 2 time(s) but was
|
123 |
+
* // executed 0 time(s).',
|
124 |
+
* // actual: 0,
|
125 |
+
* // expected: 2,
|
126 |
+
* // operator: 'func',
|
127 |
+
* // stack: stack trace
|
128 |
+
* // }
|
129 |
+
* // ]
|
130 |
+
* ```
|
131 |
+
* @since v14.2.0, v12.19.0
|
132 |
+
* @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
|
133 |
+
*/
|
134 |
+
report(): CallTrackerReportInformation[];
|
135 |
+
/**
|
136 |
+
* Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
|
137 |
+
* If no arguments are passed, all tracked functions will be reset.
|
138 |
+
*
|
139 |
+
* ```js
|
140 |
+
* import assert from 'node:assert';
|
141 |
+
*
|
142 |
+
* const tracker = new assert.CallTracker();
|
143 |
+
*
|
144 |
+
* function func() {}
|
145 |
+
* const callsfunc = tracker.calls(func);
|
146 |
+
*
|
147 |
+
* callsfunc();
|
148 |
+
* // Tracker was called once
|
149 |
+
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
|
150 |
+
*
|
151 |
+
* tracker.reset(callsfunc);
|
152 |
+
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
|
153 |
+
* ```
|
154 |
+
* @since v18.8.0, v16.18.0
|
155 |
+
* @param fn a tracked function to reset.
|
156 |
+
*/
|
157 |
+
reset(fn?: Function): void;
|
158 |
+
/**
|
159 |
+
* Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
|
160 |
+
* have not been called the expected number of times.
|
161 |
+
*
|
162 |
+
* ```js
|
163 |
+
* import assert from 'node:assert';
|
164 |
+
*
|
165 |
+
* // Creates call tracker.
|
166 |
+
* const tracker = new assert.CallTracker();
|
167 |
+
*
|
168 |
+
* function func() {}
|
169 |
+
*
|
170 |
+
* // Returns a function that wraps func() that must be called exact times
|
171 |
+
* // before tracker.verify().
|
172 |
+
* const callsfunc = tracker.calls(func, 2);
|
173 |
+
*
|
174 |
+
* callsfunc();
|
175 |
+
*
|
176 |
+
* // Will throw an error since callsfunc() was only called once.
|
177 |
+
* tracker.verify();
|
178 |
+
* ```
|
179 |
+
* @since v14.2.0, v12.19.0
|
180 |
+
*/
|
181 |
+
verify(): void;
|
182 |
+
}
|
183 |
+
interface CallTrackerCall {
|
184 |
+
thisArg: object;
|
185 |
+
arguments: unknown[];
|
186 |
+
}
|
187 |
+
interface CallTrackerReportInformation {
|
188 |
+
message: string;
|
189 |
+
/** The actual number of times the function was called. */
|
190 |
+
actual: number;
|
191 |
+
/** The number of times the function was expected to be called. */
|
192 |
+
expected: number;
|
193 |
+
/** The name of the function that is wrapped. */
|
194 |
+
operator: string;
|
195 |
+
/** A stack trace of the function. */
|
196 |
+
stack: object;
|
197 |
+
}
|
198 |
+
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
|
199 |
+
/**
|
200 |
+
* Throws an `AssertionError` with the provided error message or a default
|
201 |
+
* error message. If the `message` parameter is an instance of an `Error` then
|
202 |
+
* it will be thrown instead of the `AssertionError`.
|
203 |
+
*
|
204 |
+
* ```js
|
205 |
+
* import assert from 'node:assert/strict';
|
206 |
+
*
|
207 |
+
* assert.fail();
|
208 |
+
* // AssertionError [ERR_ASSERTION]: Failed
|
209 |
+
*
|
210 |
+
* assert.fail('boom');
|
211 |
+
* // AssertionError [ERR_ASSERTION]: boom
|
212 |
+
*
|
213 |
+
* assert.fail(new TypeError('need array'));
|
214 |
+
* // TypeError: need array
|
215 |
+
* ```
|
216 |
+
*
|
217 |
+
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
218 |
+
* See below for further details.
|
219 |
+
* @since v0.1.21
|
220 |
+
* @param [message='Failed']
|
221 |
+
*/
|
222 |
+
function fail(message?: string | Error): never;
|
223 |
+
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
224 |
+
function fail(
|
225 |
+
actual: unknown,
|
226 |
+
expected: unknown,
|
227 |
+
message?: string | Error,
|
228 |
+
operator?: string,
|
229 |
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
230 |
+
stackStartFn?: Function,
|
231 |
+
): never;
|
232 |
+
/**
|
233 |
+
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
234 |
+
*
|
235 |
+
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
|
236 |
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
237 |
+
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
238 |
+
*
|
239 |
+
* Be aware that in the `repl` the error message will be different to the one
|
240 |
+
* thrown in a file! See below for further details.
|
241 |
+
*
|
242 |
+
* ```js
|
243 |
+
* import assert from 'node:assert/strict';
|
244 |
+
*
|
245 |
+
* assert.ok(true);
|
246 |
+
* // OK
|
247 |
+
* assert.ok(1);
|
248 |
+
* // OK
|
249 |
+
*
|
250 |
+
* assert.ok();
|
251 |
+
* // AssertionError: No value argument passed to `assert.ok()`
|
252 |
+
*
|
253 |
+
* assert.ok(false, 'it\'s false');
|
254 |
+
* // AssertionError: it's false
|
255 |
+
*
|
256 |
+
* // In the repl:
|
257 |
+
* assert.ok(typeof 123 === 'string');
|
258 |
+
* // AssertionError: false == true
|
259 |
+
*
|
260 |
+
* // In a file (e.g. test.js):
|
261 |
+
* assert.ok(typeof 123 === 'string');
|
262 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
263 |
+
* //
|
264 |
+
* // assert.ok(typeof 123 === 'string')
|
265 |
+
*
|
266 |
+
* assert.ok(false);
|
267 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
268 |
+
* //
|
269 |
+
* // assert.ok(false)
|
270 |
+
*
|
271 |
+
* assert.ok(0);
|
272 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
273 |
+
* //
|
274 |
+
* // assert.ok(0)
|
275 |
+
* ```
|
276 |
+
*
|
277 |
+
* ```js
|
278 |
+
* import assert from 'node:assert/strict';
|
279 |
+
*
|
280 |
+
* // Using `assert()` works the same:
|
281 |
+
* assert(0);
|
282 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
283 |
+
* //
|
284 |
+
* // assert(0)
|
285 |
+
* ```
|
286 |
+
* @since v0.1.21
|
287 |
+
*/
|
288 |
+
function ok(value: unknown, message?: string | Error): asserts value;
|
289 |
+
/**
|
290 |
+
* **Strict assertion mode**
|
291 |
+
*
|
292 |
+
* An alias of {@link strictEqual}.
|
293 |
+
*
|
294 |
+
* **Legacy assertion mode**
|
295 |
+
*
|
296 |
+
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
297 |
+
*
|
298 |
+
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
299 |
+
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
300 |
+
* and treated as being identical if both sides are `NaN`.
|
301 |
+
*
|
302 |
+
* ```js
|
303 |
+
* import assert from 'node:assert';
|
304 |
+
*
|
305 |
+
* assert.equal(1, 1);
|
306 |
+
* // OK, 1 == 1
|
307 |
+
* assert.equal(1, '1');
|
308 |
+
* // OK, 1 == '1'
|
309 |
+
* assert.equal(NaN, NaN);
|
310 |
+
* // OK
|
311 |
+
*
|
312 |
+
* assert.equal(1, 2);
|
313 |
+
* // AssertionError: 1 == 2
|
314 |
+
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
315 |
+
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
316 |
+
* ```
|
317 |
+
*
|
318 |
+
* If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
319 |
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
320 |
+
* @since v0.1.21
|
321 |
+
*/
|
322 |
+
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
323 |
+
/**
|
324 |
+
* **Strict assertion mode**
|
325 |
+
*
|
326 |
+
* An alias of {@link notStrictEqual}.
|
327 |
+
*
|
328 |
+
* **Legacy assertion mode**
|
329 |
+
*
|
330 |
+
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
331 |
+
*
|
332 |
+
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
333 |
+
* specially handled and treated as being identical if both sides are `NaN`.
|
334 |
+
*
|
335 |
+
* ```js
|
336 |
+
* import assert from 'node:assert';
|
337 |
+
*
|
338 |
+
* assert.notEqual(1, 2);
|
339 |
+
* // OK
|
340 |
+
*
|
341 |
+
* assert.notEqual(1, 1);
|
342 |
+
* // AssertionError: 1 != 1
|
343 |
+
*
|
344 |
+
* assert.notEqual(1, '1');
|
345 |
+
* // AssertionError: 1 != '1'
|
346 |
+
* ```
|
347 |
+
*
|
348 |
+
* If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
|
349 |
+
* message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
350 |
+
* @since v0.1.21
|
351 |
+
*/
|
352 |
+
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
353 |
+
/**
|
354 |
+
* **Strict assertion mode**
|
355 |
+
*
|
356 |
+
* An alias of {@link deepStrictEqual}.
|
357 |
+
*
|
358 |
+
* **Legacy assertion mode**
|
359 |
+
*
|
360 |
+
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
361 |
+
*
|
362 |
+
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
363 |
+
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
364 |
+
* surprising results.
|
365 |
+
*
|
366 |
+
* _Deep equality_ means that the enumerable "own" properties of child objects
|
367 |
+
* are also recursively evaluated by the following rules.
|
368 |
+
* @since v0.1.21
|
369 |
+
*/
|
370 |
+
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
371 |
+
/**
|
372 |
+
* **Strict assertion mode**
|
373 |
+
*
|
374 |
+
* An alias of {@link notDeepStrictEqual}.
|
375 |
+
*
|
376 |
+
* **Legacy assertion mode**
|
377 |
+
*
|
378 |
+
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
379 |
+
*
|
380 |
+
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
381 |
+
*
|
382 |
+
* ```js
|
383 |
+
* import assert from 'node:assert';
|
384 |
+
*
|
385 |
+
* const obj1 = {
|
386 |
+
* a: {
|
387 |
+
* b: 1,
|
388 |
+
* },
|
389 |
+
* };
|
390 |
+
* const obj2 = {
|
391 |
+
* a: {
|
392 |
+
* b: 2,
|
393 |
+
* },
|
394 |
+
* };
|
395 |
+
* const obj3 = {
|
396 |
+
* a: {
|
397 |
+
* b: 1,
|
398 |
+
* },
|
399 |
+
* };
|
400 |
+
* const obj4 = { __proto__: obj1 };
|
401 |
+
*
|
402 |
+
* assert.notDeepEqual(obj1, obj1);
|
403 |
+
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
404 |
+
*
|
405 |
+
* assert.notDeepEqual(obj1, obj2);
|
406 |
+
* // OK
|
407 |
+
*
|
408 |
+
* assert.notDeepEqual(obj1, obj3);
|
409 |
+
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
410 |
+
*
|
411 |
+
* assert.notDeepEqual(obj1, obj4);
|
412 |
+
* // OK
|
413 |
+
* ```
|
414 |
+
*
|
415 |
+
* If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
416 |
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
417 |
+
* instead of the `AssertionError`.
|
418 |
+
* @since v0.1.21
|
419 |
+
*/
|
420 |
+
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
421 |
+
/**
|
422 |
+
* Tests strict equality between the `actual` and `expected` parameters as
|
423 |
+
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
424 |
+
*
|
425 |
+
* ```js
|
426 |
+
* import assert from 'node:assert/strict';
|
427 |
+
*
|
428 |
+
* assert.strictEqual(1, 2);
|
429 |
+
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
430 |
+
* //
|
431 |
+
* // 1 !== 2
|
432 |
+
*
|
433 |
+
* assert.strictEqual(1, 1);
|
434 |
+
* // OK
|
435 |
+
*
|
436 |
+
* assert.strictEqual('Hello foobar', 'Hello World!');
|
437 |
+
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
438 |
+
* // + actual - expected
|
439 |
+
* //
|
440 |
+
* // + 'Hello foobar'
|
441 |
+
* // - 'Hello World!'
|
442 |
+
* // ^
|
443 |
+
*
|
444 |
+
* const apples = 1;
|
445 |
+
* const oranges = 2;
|
446 |
+
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
447 |
+
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
448 |
+
*
|
449 |
+
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
450 |
+
* // TypeError: Inputs are not identical
|
451 |
+
* ```
|
452 |
+
*
|
453 |
+
* If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
454 |
+
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
455 |
+
* instead of the `AssertionError`.
|
456 |
+
* @since v0.1.21
|
457 |
+
*/
|
458 |
+
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
459 |
+
/**
|
460 |
+
* Tests strict inequality between the `actual` and `expected` parameters as
|
461 |
+
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
462 |
+
*
|
463 |
+
* ```js
|
464 |
+
* import assert from 'node:assert/strict';
|
465 |
+
*
|
466 |
+
* assert.notStrictEqual(1, 2);
|
467 |
+
* // OK
|
468 |
+
*
|
469 |
+
* assert.notStrictEqual(1, 1);
|
470 |
+
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
471 |
+
* //
|
472 |
+
* // 1
|
473 |
+
*
|
474 |
+
* assert.notStrictEqual(1, '1');
|
475 |
+
* // OK
|
476 |
+
* ```
|
477 |
+
*
|
478 |
+
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
479 |
+
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
480 |
+
* instead of the `AssertionError`.
|
481 |
+
* @since v0.1.21
|
482 |
+
*/
|
483 |
+
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
484 |
+
/**
|
485 |
+
* Tests for deep equality between the `actual` and `expected` parameters.
|
486 |
+
* "Deep" equality means that the enumerable "own" properties of child objects
|
487 |
+
* are recursively evaluated also by the following rules.
|
488 |
+
* @since v1.2.0
|
489 |
+
*/
|
490 |
+
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
491 |
+
/**
|
492 |
+
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
493 |
+
*
|
494 |
+
* ```js
|
495 |
+
* import assert from 'node:assert/strict';
|
496 |
+
*
|
497 |
+
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
498 |
+
* // OK
|
499 |
+
* ```
|
500 |
+
*
|
501 |
+
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
502 |
+
* with a `message` property set equal to the value of the `message` parameter. If
|
503 |
+
* the `message` parameter is undefined, a default error message is assigned. If
|
504 |
+
* the `message` parameter is an instance of an `Error` then it will be thrown
|
505 |
+
* instead of the `AssertionError`.
|
506 |
+
* @since v1.2.0
|
507 |
+
*/
|
508 |
+
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
509 |
+
/**
|
510 |
+
* Expects the function `fn` to throw an error.
|
511 |
+
*
|
512 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
513 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
514 |
+
* a validation object where each property will be tested for strict deep equality,
|
515 |
+
* or an instance of error where each property will be tested for strict deep
|
516 |
+
* equality including the non-enumerable `message` and `name` properties. When
|
517 |
+
* using an object, it is also possible to use a regular expression, when
|
518 |
+
* validating against a string property. See below for examples.
|
519 |
+
*
|
520 |
+
* If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
|
521 |
+
* fails.
|
522 |
+
*
|
523 |
+
* Custom validation object/error instance:
|
524 |
+
*
|
525 |
+
* ```js
|
526 |
+
* import assert from 'node:assert/strict';
|
527 |
+
*
|
528 |
+
* const err = new TypeError('Wrong value');
|
529 |
+
* err.code = 404;
|
530 |
+
* err.foo = 'bar';
|
531 |
+
* err.info = {
|
532 |
+
* nested: true,
|
533 |
+
* baz: 'text',
|
534 |
+
* };
|
535 |
+
* err.reg = /abc/i;
|
536 |
+
*
|
537 |
+
* assert.throws(
|
538 |
+
* () => {
|
539 |
+
* throw err;
|
540 |
+
* },
|
541 |
+
* {
|
542 |
+
* name: 'TypeError',
|
543 |
+
* message: 'Wrong value',
|
544 |
+
* info: {
|
545 |
+
* nested: true,
|
546 |
+
* baz: 'text',
|
547 |
+
* },
|
548 |
+
* // Only properties on the validation object will be tested for.
|
549 |
+
* // Using nested objects requires all properties to be present. Otherwise
|
550 |
+
* // the validation is going to fail.
|
551 |
+
* },
|
552 |
+
* );
|
553 |
+
*
|
554 |
+
* // Using regular expressions to validate error properties:
|
555 |
+
* assert.throws(
|
556 |
+
* () => {
|
557 |
+
* throw err;
|
558 |
+
* },
|
559 |
+
* {
|
560 |
+
* // The `name` and `message` properties are strings and using regular
|
561 |
+
* // expressions on those will match against the string. If they fail, an
|
562 |
+
* // error is thrown.
|
563 |
+
* name: /^TypeError$/,
|
564 |
+
* message: /Wrong/,
|
565 |
+
* foo: 'bar',
|
566 |
+
* info: {
|
567 |
+
* nested: true,
|
568 |
+
* // It is not possible to use regular expressions for nested properties!
|
569 |
+
* baz: 'text',
|
570 |
+
* },
|
571 |
+
* // The `reg` property contains a regular expression and only if the
|
572 |
+
* // validation object contains an identical regular expression, it is going
|
573 |
+
* // to pass.
|
574 |
+
* reg: /abc/i,
|
575 |
+
* },
|
576 |
+
* );
|
577 |
+
*
|
578 |
+
* // Fails due to the different `message` and `name` properties:
|
579 |
+
* assert.throws(
|
580 |
+
* () => {
|
581 |
+
* const otherErr = new Error('Not found');
|
582 |
+
* // Copy all enumerable properties from `err` to `otherErr`.
|
583 |
+
* for (const [key, value] of Object.entries(err)) {
|
584 |
+
* otherErr[key] = value;
|
585 |
+
* }
|
586 |
+
* throw otherErr;
|
587 |
+
* },
|
588 |
+
* // The error's `message` and `name` properties will also be checked when using
|
589 |
+
* // an error as validation object.
|
590 |
+
* err,
|
591 |
+
* );
|
592 |
+
* ```
|
593 |
+
*
|
594 |
+
* Validate instanceof using constructor:
|
595 |
+
*
|
596 |
+
* ```js
|
597 |
+
* import assert from 'node:assert/strict';
|
598 |
+
*
|
599 |
+
* assert.throws(
|
600 |
+
* () => {
|
601 |
+
* throw new Error('Wrong value');
|
602 |
+
* },
|
603 |
+
* Error,
|
604 |
+
* );
|
605 |
+
* ```
|
606 |
+
*
|
607 |
+
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
608 |
+
*
|
609 |
+
* Using a regular expression runs `.toString` on the error object, and will
|
610 |
+
* therefore also include the error name.
|
611 |
+
*
|
612 |
+
* ```js
|
613 |
+
* import assert from 'node:assert/strict';
|
614 |
+
*
|
615 |
+
* assert.throws(
|
616 |
+
* () => {
|
617 |
+
* throw new Error('Wrong value');
|
618 |
+
* },
|
619 |
+
* /^Error: Wrong value$/,
|
620 |
+
* );
|
621 |
+
* ```
|
622 |
+
*
|
623 |
+
* Custom error validation:
|
624 |
+
*
|
625 |
+
* The function must return `true` to indicate all internal validations passed.
|
626 |
+
* It will otherwise fail with an `AssertionError`.
|
627 |
+
*
|
628 |
+
* ```js
|
629 |
+
* import assert from 'node:assert/strict';
|
630 |
+
*
|
631 |
+
* assert.throws(
|
632 |
+
* () => {
|
633 |
+
* throw new Error('Wrong value');
|
634 |
+
* },
|
635 |
+
* (err) => {
|
636 |
+
* assert(err instanceof Error);
|
637 |
+
* assert(/value/.test(err));
|
638 |
+
* // Avoid returning anything from validation functions besides `true`.
|
639 |
+
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
640 |
+
* // throw an error about the specific validation that failed (as done in this
|
641 |
+
* // example) and add as much helpful debugging information to that error as
|
642 |
+
* // possible.
|
643 |
+
* return true;
|
644 |
+
* },
|
645 |
+
* 'unexpected error',
|
646 |
+
* );
|
647 |
+
* ```
|
648 |
+
*
|
649 |
+
* `error` cannot be a string. If a string is provided as the second
|
650 |
+
* argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
|
651 |
+
* message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
652 |
+
* a string as the second argument gets considered:
|
653 |
+
*
|
654 |
+
* ```js
|
655 |
+
* import assert from 'node:assert/strict';
|
656 |
+
*
|
657 |
+
* function throwingFirst() {
|
658 |
+
* throw new Error('First');
|
659 |
+
* }
|
660 |
+
*
|
661 |
+
* function throwingSecond() {
|
662 |
+
* throw new Error('Second');
|
663 |
+
* }
|
664 |
+
*
|
665 |
+
* function notThrowing() {}
|
666 |
+
*
|
667 |
+
* // The second argument is a string and the input function threw an Error.
|
668 |
+
* // The first case will not throw as it does not match for the error message
|
669 |
+
* // thrown by the input function!
|
670 |
+
* assert.throws(throwingFirst, 'Second');
|
671 |
+
* // In the next example the message has no benefit over the message from the
|
672 |
+
* // error and since it is not clear if the user intended to actually match
|
673 |
+
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
674 |
+
* assert.throws(throwingSecond, 'Second');
|
675 |
+
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
676 |
+
*
|
677 |
+
* // The string is only used (as message) in case the function does not throw:
|
678 |
+
* assert.throws(notThrowing, 'Second');
|
679 |
+
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
680 |
+
*
|
681 |
+
* // If it was intended to match for the error message do this instead:
|
682 |
+
* // It does not throw because the error messages match.
|
683 |
+
* assert.throws(throwingSecond, /Second$/);
|
684 |
+
*
|
685 |
+
* // If the error message does not match, an AssertionError is thrown.
|
686 |
+
* assert.throws(throwingFirst, /Second$/);
|
687 |
+
* // AssertionError [ERR_ASSERTION]
|
688 |
+
* ```
|
689 |
+
*
|
690 |
+
* Due to the confusing error-prone notation, avoid a string as the second
|
691 |
+
* argument.
|
692 |
+
* @since v0.1.21
|
693 |
+
*/
|
694 |
+
function throws(block: () => unknown, message?: string | Error): void;
|
695 |
+
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
696 |
+
/**
|
697 |
+
* Asserts that the function `fn` does not throw an error.
|
698 |
+
*
|
699 |
+
* Using `assert.doesNotThrow()` is actually not useful because there
|
700 |
+
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
701 |
+
* adding a comment next to the specific code path that should not throw and keep
|
702 |
+
* error messages as expressive as possible.
|
703 |
+
*
|
704 |
+
* When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
|
705 |
+
*
|
706 |
+
* If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
|
707 |
+
* different type, or if the `error` parameter is undefined, the error is
|
708 |
+
* propagated back to the caller.
|
709 |
+
*
|
710 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
711 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
|
712 |
+
* function. See {@link throws} for more details.
|
713 |
+
*
|
714 |
+
* The following, for instance, will throw the `TypeError` because there is no
|
715 |
+
* matching error type in the assertion:
|
716 |
+
*
|
717 |
+
* ```js
|
718 |
+
* import assert from 'node:assert/strict';
|
719 |
+
*
|
720 |
+
* assert.doesNotThrow(
|
721 |
+
* () => {
|
722 |
+
* throw new TypeError('Wrong value');
|
723 |
+
* },
|
724 |
+
* SyntaxError,
|
725 |
+
* );
|
726 |
+
* ```
|
727 |
+
*
|
728 |
+
* However, the following will result in an `AssertionError` with the message
|
729 |
+
* 'Got unwanted exception...':
|
730 |
+
*
|
731 |
+
* ```js
|
732 |
+
* import assert from 'node:assert/strict';
|
733 |
+
*
|
734 |
+
* assert.doesNotThrow(
|
735 |
+
* () => {
|
736 |
+
* throw new TypeError('Wrong value');
|
737 |
+
* },
|
738 |
+
* TypeError,
|
739 |
+
* );
|
740 |
+
* ```
|
741 |
+
*
|
742 |
+
* If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
|
743 |
+
*
|
744 |
+
* ```js
|
745 |
+
* import assert from 'node:assert/strict';
|
746 |
+
*
|
747 |
+
* assert.doesNotThrow(
|
748 |
+
* () => {
|
749 |
+
* throw new TypeError('Wrong value');
|
750 |
+
* },
|
751 |
+
* /Wrong value/,
|
752 |
+
* 'Whoops',
|
753 |
+
* );
|
754 |
+
* // Throws: AssertionError: Got unwanted exception: Whoops
|
755 |
+
* ```
|
756 |
+
* @since v0.1.21
|
757 |
+
*/
|
758 |
+
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
759 |
+
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
760 |
+
/**
|
761 |
+
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
762 |
+
* testing the `error` argument in callbacks. The stack trace contains all frames
|
763 |
+
* from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
|
764 |
+
*
|
765 |
+
* ```js
|
766 |
+
* import assert from 'node:assert/strict';
|
767 |
+
*
|
768 |
+
* assert.ifError(null);
|
769 |
+
* // OK
|
770 |
+
* assert.ifError(0);
|
771 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
772 |
+
* assert.ifError('error');
|
773 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
774 |
+
* assert.ifError(new Error());
|
775 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
776 |
+
*
|
777 |
+
* // Create some random error frames.
|
778 |
+
* let err;
|
779 |
+
* (function errorFrame() {
|
780 |
+
* err = new Error('test error');
|
781 |
+
* })();
|
782 |
+
*
|
783 |
+
* (function ifErrorFrame() {
|
784 |
+
* assert.ifError(err);
|
785 |
+
* })();
|
786 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
787 |
+
* // at ifErrorFrame
|
788 |
+
* // at errorFrame
|
789 |
+
* ```
|
790 |
+
* @since v0.1.97
|
791 |
+
*/
|
792 |
+
function ifError(value: unknown): asserts value is null | undefined;
|
793 |
+
/**
|
794 |
+
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
795 |
+
* calls the function and awaits the returned promise to complete. It will then
|
796 |
+
* check that the promise is rejected.
|
797 |
+
*
|
798 |
+
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
799 |
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value)
|
800 |
+
* error. In both cases the error handler is skipped.
|
801 |
+
*
|
802 |
+
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
803 |
+
*
|
804 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
805 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
806 |
+
* an object where each property will be tested for, or an instance of error where
|
807 |
+
* each property will be tested for including the non-enumerable `message` and `name` properties.
|
808 |
+
*
|
809 |
+
* If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
|
810 |
+
*
|
811 |
+
* ```js
|
812 |
+
* import assert from 'node:assert/strict';
|
813 |
+
*
|
814 |
+
* await assert.rejects(
|
815 |
+
* async () => {
|
816 |
+
* throw new TypeError('Wrong value');
|
817 |
+
* },
|
818 |
+
* {
|
819 |
+
* name: 'TypeError',
|
820 |
+
* message: 'Wrong value',
|
821 |
+
* },
|
822 |
+
* );
|
823 |
+
* ```
|
824 |
+
*
|
825 |
+
* ```js
|
826 |
+
* import assert from 'node:assert/strict';
|
827 |
+
*
|
828 |
+
* await assert.rejects(
|
829 |
+
* async () => {
|
830 |
+
* throw new TypeError('Wrong value');
|
831 |
+
* },
|
832 |
+
* (err) => {
|
833 |
+
* assert.strictEqual(err.name, 'TypeError');
|
834 |
+
* assert.strictEqual(err.message, 'Wrong value');
|
835 |
+
* return true;
|
836 |
+
* },
|
837 |
+
* );
|
838 |
+
* ```
|
839 |
+
*
|
840 |
+
* ```js
|
841 |
+
* import assert from 'node:assert/strict';
|
842 |
+
*
|
843 |
+
* assert.rejects(
|
844 |
+
* Promise.reject(new Error('Wrong value')),
|
845 |
+
* Error,
|
846 |
+
* ).then(() => {
|
847 |
+
* // ...
|
848 |
+
* });
|
849 |
+
* ```
|
850 |
+
*
|
851 |
+
* `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
|
852 |
+
* be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
|
853 |
+
* example in {@link throws} carefully if using a string as the second argument gets considered.
|
854 |
+
* @since v10.0.0
|
855 |
+
*/
|
856 |
+
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
857 |
+
function rejects(
|
858 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
859 |
+
error: AssertPredicate,
|
860 |
+
message?: string | Error,
|
861 |
+
): Promise<void>;
|
862 |
+
/**
|
863 |
+
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
864 |
+
* calls the function and awaits the returned promise to complete. It will then
|
865 |
+
* check that the promise is not rejected.
|
866 |
+
*
|
867 |
+
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
868 |
+
* the function does not return a promise, `assert.doesNotReject()` will return a
|
869 |
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v22.x/api/errors.html#err_invalid_return_value) error. In both cases
|
870 |
+
* the error handler is skipped.
|
871 |
+
*
|
872 |
+
* Using `assert.doesNotReject()` is actually not useful because there is little
|
873 |
+
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
874 |
+
* adding a comment next to the specific code path that should not reject and keep
|
875 |
+
* error messages as expressive as possible.
|
876 |
+
*
|
877 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
878 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
|
879 |
+
* function. See {@link throws} for more details.
|
880 |
+
*
|
881 |
+
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
|
882 |
+
*
|
883 |
+
* ```js
|
884 |
+
* import assert from 'node:assert/strict';
|
885 |
+
*
|
886 |
+
* await assert.doesNotReject(
|
887 |
+
* async () => {
|
888 |
+
* throw new TypeError('Wrong value');
|
889 |
+
* },
|
890 |
+
* SyntaxError,
|
891 |
+
* );
|
892 |
+
* ```
|
893 |
+
*
|
894 |
+
* ```js
|
895 |
+
* import assert from 'node:assert/strict';
|
896 |
+
*
|
897 |
+
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
898 |
+
* .then(() => {
|
899 |
+
* // ...
|
900 |
+
* });
|
901 |
+
* ```
|
902 |
+
* @since v10.0.0
|
903 |
+
*/
|
904 |
+
function doesNotReject(
|
905 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
906 |
+
message?: string | Error,
|
907 |
+
): Promise<void>;
|
908 |
+
function doesNotReject(
|
909 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
910 |
+
error: AssertPredicate,
|
911 |
+
message?: string | Error,
|
912 |
+
): Promise<void>;
|
913 |
+
/**
|
914 |
+
* Expects the `string` input to match the regular expression.
|
915 |
+
*
|
916 |
+
* ```js
|
917 |
+
* import assert from 'node:assert/strict';
|
918 |
+
*
|
919 |
+
* assert.match('I will fail', /pass/);
|
920 |
+
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
921 |
+
*
|
922 |
+
* assert.match(123, /pass/);
|
923 |
+
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
924 |
+
*
|
925 |
+
* assert.match('I will pass', /pass/);
|
926 |
+
* // OK
|
927 |
+
* ```
|
928 |
+
*
|
929 |
+
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
930 |
+
* to the value of the `message` parameter. If the `message` parameter is
|
931 |
+
* undefined, a default error message is assigned. If the `message` parameter is an
|
932 |
+
* instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
933 |
+
* @since v13.6.0, v12.16.0
|
934 |
+
*/
|
935 |
+
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
936 |
+
/**
|
937 |
+
* Expects the `string` input not to match the regular expression.
|
938 |
+
*
|
939 |
+
* ```js
|
940 |
+
* import assert from 'node:assert/strict';
|
941 |
+
*
|
942 |
+
* assert.doesNotMatch('I will fail', /fail/);
|
943 |
+
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
944 |
+
*
|
945 |
+
* assert.doesNotMatch(123, /pass/);
|
946 |
+
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
947 |
+
*
|
948 |
+
* assert.doesNotMatch('I will pass', /different/);
|
949 |
+
* // OK
|
950 |
+
* ```
|
951 |
+
*
|
952 |
+
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
953 |
+
* to the value of the `message` parameter. If the `message` parameter is
|
954 |
+
* undefined, a default error message is assigned. If the `message` parameter is an
|
955 |
+
* instance of an [Error](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
956 |
+
* @since v13.6.0, v12.16.0
|
957 |
+
*/
|
958 |
+
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
959 |
+
/**
|
960 |
+
* In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
|
961 |
+
* {@link deepEqual} will behave like {@link deepStrictEqual}.
|
962 |
+
*
|
963 |
+
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
|
964 |
+
* messages for objects display the objects, often truncated.
|
965 |
+
*
|
966 |
+
* To use strict assertion mode:
|
967 |
+
*
|
968 |
+
* ```js
|
969 |
+
* import { strict as assert } from 'node:assert';COPY
|
970 |
+
* import assert from 'node:assert/strict';
|
971 |
+
* ```
|
972 |
+
*
|
973 |
+
* Example error diff:
|
974 |
+
*
|
975 |
+
* ```js
|
976 |
+
* import { strict as assert } from 'node:assert';
|
977 |
+
*
|
978 |
+
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
979 |
+
* // AssertionError: Expected inputs to be strictly deep-equal:
|
980 |
+
* // + actual - expected ... Lines skipped
|
981 |
+
* //
|
982 |
+
* // [
|
983 |
+
* // [
|
984 |
+
* // ...
|
985 |
+
* // 2,
|
986 |
+
* // + 3
|
987 |
+
* // - '3'
|
988 |
+
* // ],
|
989 |
+
* // ...
|
990 |
+
* // 5
|
991 |
+
* // ]
|
992 |
+
* ```
|
993 |
+
*
|
994 |
+
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
995 |
+
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
996 |
+
* `getColorDepth()` documentation.
|
997 |
+
*
|
998 |
+
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
|
999 |
+
*/
|
1000 |
+
namespace strict {
|
1001 |
+
type AssertionError = assert.AssertionError;
|
1002 |
+
type AssertPredicate = assert.AssertPredicate;
|
1003 |
+
type CallTrackerCall = assert.CallTrackerCall;
|
1004 |
+
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
1005 |
+
}
|
1006 |
+
const strict:
|
1007 |
+
& Omit<
|
1008 |
+
typeof assert,
|
1009 |
+
| "equal"
|
1010 |
+
| "notEqual"
|
1011 |
+
| "deepEqual"
|
1012 |
+
| "notDeepEqual"
|
1013 |
+
| "ok"
|
1014 |
+
| "strictEqual"
|
1015 |
+
| "deepStrictEqual"
|
1016 |
+
| "ifError"
|
1017 |
+
| "strict"
|
1018 |
+
>
|
1019 |
+
& {
|
1020 |
+
(value: unknown, message?: string | Error): asserts value;
|
1021 |
+
equal: typeof strictEqual;
|
1022 |
+
notEqual: typeof notStrictEqual;
|
1023 |
+
deepEqual: typeof deepStrictEqual;
|
1024 |
+
notDeepEqual: typeof notDeepStrictEqual;
|
1025 |
+
// Mapped types and assertion functions are incompatible?
|
1026 |
+
// TS2775: Assertions require every name in the call target
|
1027 |
+
// to be declared with an explicit type annotation.
|
1028 |
+
ok: typeof ok;
|
1029 |
+
strictEqual: typeof strictEqual;
|
1030 |
+
deepStrictEqual: typeof deepStrictEqual;
|
1031 |
+
ifError: typeof ifError;
|
1032 |
+
strict: typeof strict;
|
1033 |
+
};
|
1034 |
+
}
|
1035 |
+
export = assert;
|
1036 |
+
}
|
1037 |
+
declare module "node:assert" {
|
1038 |
+
import assert = require("assert");
|
1039 |
+
export = assert;
|
1040 |
+
}
|
workers1/auto3d/node_modules/@types/node/assert/strict.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
declare module "assert/strict" {
|
2 |
+
import { strict } from "node:assert";
|
3 |
+
export = strict;
|
4 |
+
}
|
5 |
+
declare module "node:assert/strict" {
|
6 |
+
import { strict } from "node:assert";
|
7 |
+
export = strict;
|
8 |
+
}
|
workers1/auto3d/node_modules/@types/node/async_hooks.d.ts
ADDED
@@ -0,0 +1,541 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* We strongly discourage the use of the `async_hooks` API.
|
3 |
+
* Other APIs that can cover most of its use cases include:
|
4 |
+
*
|
5 |
+
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v22.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
6 |
+
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
7 |
+
*
|
8 |
+
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
9 |
+
* It can be accessed using:
|
10 |
+
*
|
11 |
+
* ```js
|
12 |
+
* import async_hooks from 'node:async_hooks';
|
13 |
+
* ```
|
14 |
+
* @experimental
|
15 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/async_hooks.js)
|
16 |
+
*/
|
17 |
+
declare module "async_hooks" {
|
18 |
+
/**
|
19 |
+
* ```js
|
20 |
+
* import { executionAsyncId } from 'node:async_hooks';
|
21 |
+
* import fs from 'node:fs';
|
22 |
+
*
|
23 |
+
* console.log(executionAsyncId()); // 1 - bootstrap
|
24 |
+
* const path = '.';
|
25 |
+
* fs.open(path, 'r', (err, fd) => {
|
26 |
+
* console.log(executionAsyncId()); // 6 - open()
|
27 |
+
* });
|
28 |
+
* ```
|
29 |
+
*
|
30 |
+
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
31 |
+
* causality (which is covered by `triggerAsyncId()`):
|
32 |
+
*
|
33 |
+
* ```js
|
34 |
+
* const server = net.createServer((conn) => {
|
35 |
+
* // Returns the ID of the server, not of the new connection, because the
|
36 |
+
* // callback runs in the execution scope of the server's MakeCallback().
|
37 |
+
* async_hooks.executionAsyncId();
|
38 |
+
*
|
39 |
+
* }).listen(port, () => {
|
40 |
+
* // Returns the ID of a TickObject (process.nextTick()) because all
|
41 |
+
* // callbacks passed to .listen() are wrapped in a nextTick().
|
42 |
+
* async_hooks.executionAsyncId();
|
43 |
+
* });
|
44 |
+
* ```
|
45 |
+
*
|
46 |
+
* Promise contexts may not get precise `executionAsyncIds` by default.
|
47 |
+
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking).
|
48 |
+
* @since v8.1.0
|
49 |
+
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
50 |
+
*/
|
51 |
+
function executionAsyncId(): number;
|
52 |
+
/**
|
53 |
+
* Resource objects returned by `executionAsyncResource()` are most often internal
|
54 |
+
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
55 |
+
* on the object is likely to crash your application and should be avoided.
|
56 |
+
*
|
57 |
+
* Using `executionAsyncResource()` in the top-level execution context will
|
58 |
+
* return an empty object as there is no handle or request object to use,
|
59 |
+
* but having an object representing the top-level can be helpful.
|
60 |
+
*
|
61 |
+
* ```js
|
62 |
+
* import { open } from 'node:fs';
|
63 |
+
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
|
64 |
+
*
|
65 |
+
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
66 |
+
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
67 |
+
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
68 |
+
* });
|
69 |
+
* ```
|
70 |
+
*
|
71 |
+
* This can be used to implement continuation local storage without the
|
72 |
+
* use of a tracking `Map` to store the metadata:
|
73 |
+
*
|
74 |
+
* ```js
|
75 |
+
* import { createServer } from 'node:http';
|
76 |
+
* import {
|
77 |
+
* executionAsyncId,
|
78 |
+
* executionAsyncResource,
|
79 |
+
* createHook,
|
80 |
+
* } from 'async_hooks';
|
81 |
+
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
82 |
+
*
|
83 |
+
* createHook({
|
84 |
+
* init(asyncId, type, triggerAsyncId, resource) {
|
85 |
+
* const cr = executionAsyncResource();
|
86 |
+
* if (cr) {
|
87 |
+
* resource[sym] = cr[sym];
|
88 |
+
* }
|
89 |
+
* },
|
90 |
+
* }).enable();
|
91 |
+
*
|
92 |
+
* const server = createServer((req, res) => {
|
93 |
+
* executionAsyncResource()[sym] = { state: req.url };
|
94 |
+
* setTimeout(function() {
|
95 |
+
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
96 |
+
* }, 100);
|
97 |
+
* }).listen(3000);
|
98 |
+
* ```
|
99 |
+
* @since v13.9.0, v12.17.0
|
100 |
+
* @return The resource representing the current execution. Useful to store data within the resource.
|
101 |
+
*/
|
102 |
+
function executionAsyncResource(): object;
|
103 |
+
/**
|
104 |
+
* ```js
|
105 |
+
* const server = net.createServer((conn) => {
|
106 |
+
* // The resource that caused (or triggered) this callback to be called
|
107 |
+
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
108 |
+
* // is the asyncId of "conn".
|
109 |
+
* async_hooks.triggerAsyncId();
|
110 |
+
*
|
111 |
+
* }).listen(port, () => {
|
112 |
+
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
113 |
+
* // the callback itself exists because the call to the server's .listen()
|
114 |
+
* // was made. So the return value would be the ID of the server.
|
115 |
+
* async_hooks.triggerAsyncId();
|
116 |
+
* });
|
117 |
+
* ```
|
118 |
+
*
|
119 |
+
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
120 |
+
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v22.x/api/async_hooks.html#promise-execution-tracking).
|
121 |
+
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
122 |
+
*/
|
123 |
+
function triggerAsyncId(): number;
|
124 |
+
interface HookCallbacks {
|
125 |
+
/**
|
126 |
+
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
127 |
+
* @param asyncId A unique ID for the async resource
|
128 |
+
* @param type The type of the async resource
|
129 |
+
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
|
130 |
+
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
|
131 |
+
*/
|
132 |
+
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
133 |
+
/**
|
134 |
+
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
135 |
+
* The before callback is called just before said callback is executed.
|
136 |
+
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
137 |
+
*/
|
138 |
+
before?(asyncId: number): void;
|
139 |
+
/**
|
140 |
+
* Called immediately after the callback specified in `before` is completed.
|
141 |
+
*
|
142 |
+
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
|
143 |
+
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
144 |
+
*/
|
145 |
+
after?(asyncId: number): void;
|
146 |
+
/**
|
147 |
+
* Called when a promise has resolve() called. This may not be in the same execution id
|
148 |
+
* as the promise itself.
|
149 |
+
* @param asyncId the unique id for the promise that was resolve()d.
|
150 |
+
*/
|
151 |
+
promiseResolve?(asyncId: number): void;
|
152 |
+
/**
|
153 |
+
* Called after the resource corresponding to asyncId is destroyed
|
154 |
+
* @param asyncId a unique ID for the async resource
|
155 |
+
*/
|
156 |
+
destroy?(asyncId: number): void;
|
157 |
+
}
|
158 |
+
interface AsyncHook {
|
159 |
+
/**
|
160 |
+
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
161 |
+
*/
|
162 |
+
enable(): this;
|
163 |
+
/**
|
164 |
+
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
165 |
+
*/
|
166 |
+
disable(): this;
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* Registers functions to be called for different lifetime events of each async
|
170 |
+
* operation.
|
171 |
+
*
|
172 |
+
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
173 |
+
* respective asynchronous event during a resource's lifetime.
|
174 |
+
*
|
175 |
+
* All callbacks are optional. For example, if only resource cleanup needs to
|
176 |
+
* be tracked, then only the `destroy` callback needs to be passed. The
|
177 |
+
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
178 |
+
*
|
179 |
+
* ```js
|
180 |
+
* import { createHook } from 'node:async_hooks';
|
181 |
+
*
|
182 |
+
* const asyncHook = createHook({
|
183 |
+
* init(asyncId, type, triggerAsyncId, resource) { },
|
184 |
+
* destroy(asyncId) { },
|
185 |
+
* });
|
186 |
+
* ```
|
187 |
+
*
|
188 |
+
* The callbacks will be inherited via the prototype chain:
|
189 |
+
*
|
190 |
+
* ```js
|
191 |
+
* class MyAsyncCallbacks {
|
192 |
+
* init(asyncId, type, triggerAsyncId, resource) { }
|
193 |
+
* destroy(asyncId) {}
|
194 |
+
* }
|
195 |
+
*
|
196 |
+
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
197 |
+
* before(asyncId) { }
|
198 |
+
* after(asyncId) { }
|
199 |
+
* }
|
200 |
+
*
|
201 |
+
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
202 |
+
* ```
|
203 |
+
*
|
204 |
+
* Because promises are asynchronous resources whose lifecycle is tracked
|
205 |
+
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
206 |
+
* @since v8.1.0
|
207 |
+
* @param callbacks The `Hook Callbacks` to register
|
208 |
+
* @return Instance used for disabling and enabling hooks
|
209 |
+
*/
|
210 |
+
function createHook(callbacks: HookCallbacks): AsyncHook;
|
211 |
+
interface AsyncResourceOptions {
|
212 |
+
/**
|
213 |
+
* The ID of the execution context that created this async event.
|
214 |
+
* @default executionAsyncId()
|
215 |
+
*/
|
216 |
+
triggerAsyncId?: number | undefined;
|
217 |
+
/**
|
218 |
+
* Disables automatic `emitDestroy` when the object is garbage collected.
|
219 |
+
* This usually does not need to be set (even if `emitDestroy` is called
|
220 |
+
* manually), unless the resource's `asyncId` is retrieved and the
|
221 |
+
* sensitive API's `emitDestroy` is called with it.
|
222 |
+
* @default false
|
223 |
+
*/
|
224 |
+
requireManualDestroy?: boolean | undefined;
|
225 |
+
}
|
226 |
+
/**
|
227 |
+
* The class `AsyncResource` is designed to be extended by the embedder's async
|
228 |
+
* resources. Using this, users can easily trigger the lifetime events of their
|
229 |
+
* own resources.
|
230 |
+
*
|
231 |
+
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
232 |
+
*
|
233 |
+
* The following is an overview of the `AsyncResource` API.
|
234 |
+
*
|
235 |
+
* ```js
|
236 |
+
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
|
237 |
+
*
|
238 |
+
* // AsyncResource() is meant to be extended. Instantiating a
|
239 |
+
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
240 |
+
* // async_hook.executionAsyncId() is used.
|
241 |
+
* const asyncResource = new AsyncResource(
|
242 |
+
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
|
243 |
+
* );
|
244 |
+
*
|
245 |
+
* // Run a function in the execution context of the resource. This will
|
246 |
+
* // * establish the context of the resource
|
247 |
+
* // * trigger the AsyncHooks before callbacks
|
248 |
+
* // * call the provided function `fn` with the supplied arguments
|
249 |
+
* // * trigger the AsyncHooks after callbacks
|
250 |
+
* // * restore the original execution context
|
251 |
+
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
252 |
+
*
|
253 |
+
* // Call AsyncHooks destroy callbacks.
|
254 |
+
* asyncResource.emitDestroy();
|
255 |
+
*
|
256 |
+
* // Return the unique ID assigned to the AsyncResource instance.
|
257 |
+
* asyncResource.asyncId();
|
258 |
+
*
|
259 |
+
* // Return the trigger ID for the AsyncResource instance.
|
260 |
+
* asyncResource.triggerAsyncId();
|
261 |
+
* ```
|
262 |
+
*/
|
263 |
+
class AsyncResource {
|
264 |
+
/**
|
265 |
+
* AsyncResource() is meant to be extended. Instantiating a
|
266 |
+
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
267 |
+
* async_hook.executionAsyncId() is used.
|
268 |
+
* @param type The type of async event.
|
269 |
+
* @param triggerAsyncId The ID of the execution context that created
|
270 |
+
* this async event (default: `executionAsyncId()`), or an
|
271 |
+
* AsyncResourceOptions object (since v9.3.0)
|
272 |
+
*/
|
273 |
+
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
274 |
+
/**
|
275 |
+
* Binds the given function to the current execution context.
|
276 |
+
* @since v14.8.0, v12.19.0
|
277 |
+
* @param fn The function to bind to the current execution context.
|
278 |
+
* @param type An optional name to associate with the underlying `AsyncResource`.
|
279 |
+
*/
|
280 |
+
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
281 |
+
fn: Func,
|
282 |
+
type?: string,
|
283 |
+
thisArg?: ThisArg,
|
284 |
+
): Func;
|
285 |
+
/**
|
286 |
+
* Binds the given function to execute to this `AsyncResource`'s scope.
|
287 |
+
* @since v14.8.0, v12.19.0
|
288 |
+
* @param fn The function to bind to the current `AsyncResource`.
|
289 |
+
*/
|
290 |
+
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
291 |
+
/**
|
292 |
+
* Call the provided function with the provided arguments in the execution context
|
293 |
+
* of the async resource. This will establish the context, trigger the AsyncHooks
|
294 |
+
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
295 |
+
* then restore the original execution context.
|
296 |
+
* @since v9.6.0
|
297 |
+
* @param fn The function to call in the execution context of this async resource.
|
298 |
+
* @param thisArg The receiver to be used for the function call.
|
299 |
+
* @param args Optional arguments to pass to the function.
|
300 |
+
*/
|
301 |
+
runInAsyncScope<This, Result>(
|
302 |
+
fn: (this: This, ...args: any[]) => Result,
|
303 |
+
thisArg?: This,
|
304 |
+
...args: any[]
|
305 |
+
): Result;
|
306 |
+
/**
|
307 |
+
* Call all `destroy` hooks. This should only ever be called once. An error will
|
308 |
+
* be thrown if it is called more than once. This **must** be manually called. If
|
309 |
+
* the resource is left to be collected by the GC then the `destroy` hooks will
|
310 |
+
* never be called.
|
311 |
+
* @return A reference to `asyncResource`.
|
312 |
+
*/
|
313 |
+
emitDestroy(): this;
|
314 |
+
/**
|
315 |
+
* @return The unique `asyncId` assigned to the resource.
|
316 |
+
*/
|
317 |
+
asyncId(): number;
|
318 |
+
/**
|
319 |
+
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
320 |
+
*/
|
321 |
+
triggerAsyncId(): number;
|
322 |
+
}
|
323 |
+
/**
|
324 |
+
* This class creates stores that stay coherent through asynchronous operations.
|
325 |
+
*
|
326 |
+
* While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
|
327 |
+
* safe implementation that involves significant optimizations that are non-obvious
|
328 |
+
* to implement.
|
329 |
+
*
|
330 |
+
* The following example uses `AsyncLocalStorage` to build a simple logger
|
331 |
+
* that assigns IDs to incoming HTTP requests and includes them in messages
|
332 |
+
* logged within each request.
|
333 |
+
*
|
334 |
+
* ```js
|
335 |
+
* import http from 'node:http';
|
336 |
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
337 |
+
*
|
338 |
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
339 |
+
*
|
340 |
+
* function logWithId(msg) {
|
341 |
+
* const id = asyncLocalStorage.getStore();
|
342 |
+
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
343 |
+
* }
|
344 |
+
*
|
345 |
+
* let idSeq = 0;
|
346 |
+
* http.createServer((req, res) => {
|
347 |
+
* asyncLocalStorage.run(idSeq++, () => {
|
348 |
+
* logWithId('start');
|
349 |
+
* // Imagine any chain of async operations here
|
350 |
+
* setImmediate(() => {
|
351 |
+
* logWithId('finish');
|
352 |
+
* res.end();
|
353 |
+
* });
|
354 |
+
* });
|
355 |
+
* }).listen(8080);
|
356 |
+
*
|
357 |
+
* http.get('http://localhost:8080');
|
358 |
+
* http.get('http://localhost:8080');
|
359 |
+
* // Prints:
|
360 |
+
* // 0: start
|
361 |
+
* // 1: start
|
362 |
+
* // 0: finish
|
363 |
+
* // 1: finish
|
364 |
+
* ```
|
365 |
+
*
|
366 |
+
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
367 |
+
* Multiple instances can safely exist simultaneously without risk of interfering
|
368 |
+
* with each other's data.
|
369 |
+
* @since v13.10.0, v12.17.0
|
370 |
+
*/
|
371 |
+
class AsyncLocalStorage<T> {
|
372 |
+
/**
|
373 |
+
* Binds the given function to the current execution context.
|
374 |
+
* @since v19.8.0
|
375 |
+
* @experimental
|
376 |
+
* @param fn The function to bind to the current execution context.
|
377 |
+
* @return A new function that calls `fn` within the captured execution context.
|
378 |
+
*/
|
379 |
+
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
380 |
+
/**
|
381 |
+
* Captures the current execution context and returns a function that accepts a
|
382 |
+
* function as an argument. Whenever the returned function is called, it
|
383 |
+
* calls the function passed to it within the captured context.
|
384 |
+
*
|
385 |
+
* ```js
|
386 |
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
387 |
+
* const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
|
388 |
+
* const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
|
389 |
+
* console.log(result); // returns 123
|
390 |
+
* ```
|
391 |
+
*
|
392 |
+
* AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
|
393 |
+
* async context tracking purposes, for example:
|
394 |
+
*
|
395 |
+
* ```js
|
396 |
+
* class Foo {
|
397 |
+
* #runInAsyncScope = AsyncLocalStorage.snapshot();
|
398 |
+
*
|
399 |
+
* get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
|
400 |
+
* }
|
401 |
+
*
|
402 |
+
* const foo = asyncLocalStorage.run(123, () => new Foo());
|
403 |
+
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
404 |
+
* ```
|
405 |
+
* @since v19.8.0
|
406 |
+
* @experimental
|
407 |
+
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
408 |
+
*/
|
409 |
+
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
410 |
+
/**
|
411 |
+
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
412 |
+
* to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
413 |
+
*
|
414 |
+
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
415 |
+
* instance will be exited.
|
416 |
+
*
|
417 |
+
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
418 |
+
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
419 |
+
* along with the corresponding async resources.
|
420 |
+
*
|
421 |
+
* Use this method when the `asyncLocalStorage` is not in use anymore
|
422 |
+
* in the current process.
|
423 |
+
* @since v13.10.0, v12.17.0
|
424 |
+
* @experimental
|
425 |
+
*/
|
426 |
+
disable(): void;
|
427 |
+
/**
|
428 |
+
* Returns the current store.
|
429 |
+
* If called outside of an asynchronous context initialized by
|
430 |
+
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
431 |
+
* returns `undefined`.
|
432 |
+
* @since v13.10.0, v12.17.0
|
433 |
+
*/
|
434 |
+
getStore(): T | undefined;
|
435 |
+
/**
|
436 |
+
* Runs a function synchronously within a context and returns its
|
437 |
+
* return value. The store is not accessible outside of the callback function.
|
438 |
+
* The store is accessible to any asynchronous operations created within the
|
439 |
+
* callback.
|
440 |
+
*
|
441 |
+
* The optional `args` are passed to the callback function.
|
442 |
+
*
|
443 |
+
* If the callback function throws an error, the error is thrown by `run()` too.
|
444 |
+
* The stacktrace is not impacted by this call and the context is exited.
|
445 |
+
*
|
446 |
+
* Example:
|
447 |
+
*
|
448 |
+
* ```js
|
449 |
+
* const store = { id: 2 };
|
450 |
+
* try {
|
451 |
+
* asyncLocalStorage.run(store, () => {
|
452 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
453 |
+
* setTimeout(() => {
|
454 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
455 |
+
* }, 200);
|
456 |
+
* throw new Error();
|
457 |
+
* });
|
458 |
+
* } catch (e) {
|
459 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
460 |
+
* // The error will be caught here
|
461 |
+
* }
|
462 |
+
* ```
|
463 |
+
* @since v13.10.0, v12.17.0
|
464 |
+
*/
|
465 |
+
run<R>(store: T, callback: () => R): R;
|
466 |
+
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
467 |
+
/**
|
468 |
+
* Runs a function synchronously outside of a context and returns its
|
469 |
+
* return value. The store is not accessible within the callback function or
|
470 |
+
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
|
471 |
+
*
|
472 |
+
* The optional `args` are passed to the callback function.
|
473 |
+
*
|
474 |
+
* If the callback function throws an error, the error is thrown by `exit()` too.
|
475 |
+
* The stacktrace is not impacted by this call and the context is re-entered.
|
476 |
+
*
|
477 |
+
* Example:
|
478 |
+
*
|
479 |
+
* ```js
|
480 |
+
* // Within a call to run
|
481 |
+
* try {
|
482 |
+
* asyncLocalStorage.getStore(); // Returns the store object or value
|
483 |
+
* asyncLocalStorage.exit(() => {
|
484 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
485 |
+
* throw new Error();
|
486 |
+
* });
|
487 |
+
* } catch (e) {
|
488 |
+
* asyncLocalStorage.getStore(); // Returns the same object or value
|
489 |
+
* // The error will be caught here
|
490 |
+
* }
|
491 |
+
* ```
|
492 |
+
* @since v13.10.0, v12.17.0
|
493 |
+
* @experimental
|
494 |
+
*/
|
495 |
+
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
496 |
+
/**
|
497 |
+
* Transitions into the context for the remainder of the current
|
498 |
+
* synchronous execution and then persists the store through any following
|
499 |
+
* asynchronous calls.
|
500 |
+
*
|
501 |
+
* Example:
|
502 |
+
*
|
503 |
+
* ```js
|
504 |
+
* const store = { id: 1 };
|
505 |
+
* // Replaces previous store with the given store object
|
506 |
+
* asyncLocalStorage.enterWith(store);
|
507 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
508 |
+
* someAsyncOperation(() => {
|
509 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
510 |
+
* });
|
511 |
+
* ```
|
512 |
+
*
|
513 |
+
* This transition will continue for the _entire_ synchronous execution.
|
514 |
+
* This means that if, for example, the context is entered within an event
|
515 |
+
* handler subsequent event handlers will also run within that context unless
|
516 |
+
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
|
517 |
+
* to use the latter method.
|
518 |
+
*
|
519 |
+
* ```js
|
520 |
+
* const store = { id: 1 };
|
521 |
+
*
|
522 |
+
* emitter.on('my-event', () => {
|
523 |
+
* asyncLocalStorage.enterWith(store);
|
524 |
+
* });
|
525 |
+
* emitter.on('my-event', () => {
|
526 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
527 |
+
* });
|
528 |
+
*
|
529 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
530 |
+
* emitter.emit('my-event');
|
531 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
532 |
+
* ```
|
533 |
+
* @since v13.11.0, v12.17.0
|
534 |
+
* @experimental
|
535 |
+
*/
|
536 |
+
enterWith(store: T): void;
|
537 |
+
}
|
538 |
+
}
|
539 |
+
declare module "node:async_hooks" {
|
540 |
+
export * from "async_hooks";
|
541 |
+
}
|
workers1/auto3d/node_modules/@types/node/buffer.d.ts
ADDED
The diff for this file is too large to render.
See raw diff
|
|
workers1/auto3d/node_modules/@types/node/child_process.d.ts
ADDED
@@ -0,0 +1,1544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:child_process` module provides the ability to spawn subprocesses in
|
3 |
+
* a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
|
4 |
+
* is primarily provided by the {@link spawn} function:
|
5 |
+
*
|
6 |
+
* ```js
|
7 |
+
* const { spawn } = require('node:child_process');
|
8 |
+
* const ls = spawn('ls', ['-lh', '/usr']);
|
9 |
+
*
|
10 |
+
* ls.stdout.on('data', (data) => {
|
11 |
+
* console.log(`stdout: ${data}`);
|
12 |
+
* });
|
13 |
+
*
|
14 |
+
* ls.stderr.on('data', (data) => {
|
15 |
+
* console.error(`stderr: ${data}`);
|
16 |
+
* });
|
17 |
+
*
|
18 |
+
* ls.on('close', (code) => {
|
19 |
+
* console.log(`child process exited with code ${code}`);
|
20 |
+
* });
|
21 |
+
* ```
|
22 |
+
*
|
23 |
+
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
|
24 |
+
* the parent Node.js process and the spawned subprocess. These pipes have
|
25 |
+
* limited (and platform-specific) capacity. If the subprocess writes to
|
26 |
+
* stdout in excess of that limit without the output being captured, the
|
27 |
+
* subprocess blocks waiting for the pipe buffer to accept more data. This is
|
28 |
+
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
|
29 |
+
*
|
30 |
+
* The command lookup is performed using the `options.env.PATH` environment
|
31 |
+
* variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
|
32 |
+
* used. If `options.env` is set without `PATH`, lookup on Unix is performed
|
33 |
+
* on a default search path search of `/usr/bin:/bin` (see your operating system's
|
34 |
+
* manual for execvpe/execvp), on Windows the current processes environment
|
35 |
+
* variable `PATH` is used.
|
36 |
+
*
|
37 |
+
* On Windows, environment variables are case-insensitive. Node.js
|
38 |
+
* lexicographically sorts the `env` keys and uses the first one that
|
39 |
+
* case-insensitively matches. Only first (in lexicographic order) entry will be
|
40 |
+
* passed to the subprocess. This might lead to issues on Windows when passing
|
41 |
+
* objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`.
|
42 |
+
*
|
43 |
+
* The {@link spawn} method spawns the child process asynchronously,
|
44 |
+
* without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
|
45 |
+
* the event loop until the spawned process either exits or is terminated.
|
46 |
+
*
|
47 |
+
* For convenience, the `node:child_process` module provides a handful of
|
48 |
+
* synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
|
49 |
+
* top of {@link spawn} or {@link spawnSync}.
|
50 |
+
*
|
51 |
+
* * {@link exec}: spawns a shell and runs a command within that
|
52 |
+
* shell, passing the `stdout` and `stderr` to a callback function when
|
53 |
+
* complete.
|
54 |
+
* * {@link execFile}: similar to {@link exec} except
|
55 |
+
* that it spawns the command directly without first spawning a shell by
|
56 |
+
* default.
|
57 |
+
* * {@link fork}: spawns a new Node.js process and invokes a
|
58 |
+
* specified module with an IPC communication channel established that allows
|
59 |
+
* sending messages between parent and child.
|
60 |
+
* * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop.
|
61 |
+
* * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop.
|
62 |
+
*
|
63 |
+
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
64 |
+
* the synchronous methods can have significant impact on performance due to
|
65 |
+
* stalling the event loop while spawned processes complete.
|
66 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js)
|
67 |
+
*/
|
68 |
+
declare module "child_process" {
|
69 |
+
import { ObjectEncodingOptions } from "node:fs";
|
70 |
+
import { Abortable, EventEmitter } from "node:events";
|
71 |
+
import * as dgram from "node:dgram";
|
72 |
+
import * as net from "node:net";
|
73 |
+
import { Pipe, Readable, Stream, Writable } from "node:stream";
|
74 |
+
import { URL } from "node:url";
|
75 |
+
type Serializable = string | object | number | boolean | bigint;
|
76 |
+
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
77 |
+
/**
|
78 |
+
* Instances of the `ChildProcess` represent spawned child processes.
|
79 |
+
*
|
80 |
+
* Instances of `ChildProcess` are not intended to be created directly. Rather,
|
81 |
+
* use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create
|
82 |
+
* instances of `ChildProcess`.
|
83 |
+
* @since v2.2.0
|
84 |
+
*/
|
85 |
+
class ChildProcess extends EventEmitter {
|
86 |
+
/**
|
87 |
+
* A `Writable Stream` that represents the child process's `stdin`.
|
88 |
+
*
|
89 |
+
* If a child process waits to read all of its input, the child will not continue
|
90 |
+
* until this stream has been closed via `end()`.
|
91 |
+
*
|
92 |
+
* If the child was spawned with `stdio[0]` set to anything other than `'pipe'`,
|
93 |
+
* then this will be `null`.
|
94 |
+
*
|
95 |
+
* `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
|
96 |
+
* refer to the same value.
|
97 |
+
*
|
98 |
+
* The `subprocess.stdin` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
99 |
+
* @since v0.1.90
|
100 |
+
*/
|
101 |
+
stdin: Writable | null;
|
102 |
+
/**
|
103 |
+
* A `Readable Stream` that represents the child process's `stdout`.
|
104 |
+
*
|
105 |
+
* If the child was spawned with `stdio[1]` set to anything other than `'pipe'`,
|
106 |
+
* then this will be `null`.
|
107 |
+
*
|
108 |
+
* `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
|
109 |
+
* refer to the same value.
|
110 |
+
*
|
111 |
+
* ```js
|
112 |
+
* const { spawn } = require('node:child_process');
|
113 |
+
*
|
114 |
+
* const subprocess = spawn('ls');
|
115 |
+
*
|
116 |
+
* subprocess.stdout.on('data', (data) => {
|
117 |
+
* console.log(`Received chunk ${data}`);
|
118 |
+
* });
|
119 |
+
* ```
|
120 |
+
*
|
121 |
+
* The `subprocess.stdout` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
122 |
+
* @since v0.1.90
|
123 |
+
*/
|
124 |
+
stdout: Readable | null;
|
125 |
+
/**
|
126 |
+
* A `Readable Stream` that represents the child process's `stderr`.
|
127 |
+
*
|
128 |
+
* If the child was spawned with `stdio[2]` set to anything other than `'pipe'`,
|
129 |
+
* then this will be `null`.
|
130 |
+
*
|
131 |
+
* `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
|
132 |
+
* refer to the same value.
|
133 |
+
*
|
134 |
+
* The `subprocess.stderr` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
135 |
+
* @since v0.1.90
|
136 |
+
*/
|
137 |
+
stderr: Readable | null;
|
138 |
+
/**
|
139 |
+
* The `subprocess.channel` property is a reference to the child's IPC channel. If
|
140 |
+
* no IPC channel exists, this property is `undefined`.
|
141 |
+
* @since v7.1.0
|
142 |
+
*/
|
143 |
+
readonly channel?: Pipe | null | undefined;
|
144 |
+
/**
|
145 |
+
* A sparse array of pipes to the child process, corresponding with positions in
|
146 |
+
* the `stdio` option passed to {@link spawn} that have been set
|
147 |
+
* to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and `subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`,
|
148 |
+
* respectively.
|
149 |
+
*
|
150 |
+
* In the following example, only the child's fd `1` (stdout) is configured as a
|
151 |
+
* pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values
|
152 |
+
* in the array are `null`.
|
153 |
+
*
|
154 |
+
* ```js
|
155 |
+
* const assert = require('node:assert');
|
156 |
+
* const fs = require('node:fs');
|
157 |
+
* const child_process = require('node:child_process');
|
158 |
+
*
|
159 |
+
* const subprocess = child_process.spawn('ls', {
|
160 |
+
* stdio: [
|
161 |
+
* 0, // Use parent's stdin for child.
|
162 |
+
* 'pipe', // Pipe child's stdout to parent.
|
163 |
+
* fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
|
164 |
+
* ],
|
165 |
+
* });
|
166 |
+
*
|
167 |
+
* assert.strictEqual(subprocess.stdio[0], null);
|
168 |
+
* assert.strictEqual(subprocess.stdio[0], subprocess.stdin);
|
169 |
+
*
|
170 |
+
* assert(subprocess.stdout);
|
171 |
+
* assert.strictEqual(subprocess.stdio[1], subprocess.stdout);
|
172 |
+
*
|
173 |
+
* assert.strictEqual(subprocess.stdio[2], null);
|
174 |
+
* assert.strictEqual(subprocess.stdio[2], subprocess.stderr);
|
175 |
+
* ```
|
176 |
+
*
|
177 |
+
* The `subprocess.stdio` property can be `undefined` if the child process could
|
178 |
+
* not be successfully spawned.
|
179 |
+
* @since v0.7.10
|
180 |
+
*/
|
181 |
+
readonly stdio: [
|
182 |
+
Writable | null,
|
183 |
+
// stdin
|
184 |
+
Readable | null,
|
185 |
+
// stdout
|
186 |
+
Readable | null,
|
187 |
+
// stderr
|
188 |
+
Readable | Writable | null | undefined,
|
189 |
+
// extra
|
190 |
+
Readable | Writable | null | undefined, // extra
|
191 |
+
];
|
192 |
+
/**
|
193 |
+
* The `subprocess.killed` property indicates whether the child process
|
194 |
+
* successfully received a signal from `subprocess.kill()`. The `killed` property
|
195 |
+
* does not indicate that the child process has been terminated.
|
196 |
+
* @since v0.5.10
|
197 |
+
*/
|
198 |
+
readonly killed: boolean;
|
199 |
+
/**
|
200 |
+
* Returns the process identifier (PID) of the child process. If the child process
|
201 |
+
* fails to spawn due to errors, then the value is `undefined` and `error` is
|
202 |
+
* emitted.
|
203 |
+
*
|
204 |
+
* ```js
|
205 |
+
* const { spawn } = require('node:child_process');
|
206 |
+
* const grep = spawn('grep', ['ssh']);
|
207 |
+
*
|
208 |
+
* console.log(`Spawned child pid: ${grep.pid}`);
|
209 |
+
* grep.stdin.end();
|
210 |
+
* ```
|
211 |
+
* @since v0.1.90
|
212 |
+
*/
|
213 |
+
readonly pid?: number | undefined;
|
214 |
+
/**
|
215 |
+
* The `subprocess.connected` property indicates whether it is still possible to
|
216 |
+
* send and receive messages from a child process. When `subprocess.connected` is `false`, it is no longer possible to send or receive messages.
|
217 |
+
* @since v0.7.2
|
218 |
+
*/
|
219 |
+
readonly connected: boolean;
|
220 |
+
/**
|
221 |
+
* The `subprocess.exitCode` property indicates the exit code of the child process.
|
222 |
+
* If the child process is still running, the field will be `null`.
|
223 |
+
*/
|
224 |
+
readonly exitCode: number | null;
|
225 |
+
/**
|
226 |
+
* The `subprocess.signalCode` property indicates the signal received by
|
227 |
+
* the child process if any, else `null`.
|
228 |
+
*/
|
229 |
+
readonly signalCode: NodeJS.Signals | null;
|
230 |
+
/**
|
231 |
+
* The `subprocess.spawnargs` property represents the full list of command-line
|
232 |
+
* arguments the child process was launched with.
|
233 |
+
*/
|
234 |
+
readonly spawnargs: string[];
|
235 |
+
/**
|
236 |
+
* The `subprocess.spawnfile` property indicates the executable file name of
|
237 |
+
* the child process that is launched.
|
238 |
+
*
|
239 |
+
* For {@link fork}, its value will be equal to `process.execPath`.
|
240 |
+
* For {@link spawn}, its value will be the name of
|
241 |
+
* the executable file.
|
242 |
+
* For {@link exec}, its value will be the name of the shell
|
243 |
+
* in which the child process is launched.
|
244 |
+
*/
|
245 |
+
readonly spawnfile: string;
|
246 |
+
/**
|
247 |
+
* The `subprocess.kill()` method sends a signal to the child process. If no
|
248 |
+
* argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function
|
249 |
+
* returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
|
250 |
+
*
|
251 |
+
* ```js
|
252 |
+
* const { spawn } = require('node:child_process');
|
253 |
+
* const grep = spawn('grep', ['ssh']);
|
254 |
+
*
|
255 |
+
* grep.on('close', (code, signal) => {
|
256 |
+
* console.log(
|
257 |
+
* `child process terminated due to receipt of signal ${signal}`);
|
258 |
+
* });
|
259 |
+
*
|
260 |
+
* // Send SIGHUP to process.
|
261 |
+
* grep.kill('SIGHUP');
|
262 |
+
* ```
|
263 |
+
*
|
264 |
+
* The `ChildProcess` object may emit an `'error'` event if the signal
|
265 |
+
* cannot be delivered. Sending a signal to a child process that has already exited
|
266 |
+
* is not an error but may have unforeseen consequences. Specifically, if the
|
267 |
+
* process identifier (PID) has been reassigned to another process, the signal will
|
268 |
+
* be delivered to that process instead which can have unexpected results.
|
269 |
+
*
|
270 |
+
* While the function is called `kill`, the signal delivered to the child process
|
271 |
+
* may not actually terminate the process.
|
272 |
+
*
|
273 |
+
* See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference.
|
274 |
+
*
|
275 |
+
* On Windows, where POSIX signals do not exist, the `signal` argument will be
|
276 |
+
* ignored, and the process will be killed forcefully and abruptly (similar to `'SIGKILL'`).
|
277 |
+
* See `Signal Events` for more details.
|
278 |
+
*
|
279 |
+
* On Linux, child processes of child processes will not be terminated
|
280 |
+
* when attempting to kill their parent. This is likely to happen when running a
|
281 |
+
* new process in a shell or with the use of the `shell` option of `ChildProcess`:
|
282 |
+
*
|
283 |
+
* ```js
|
284 |
+
* 'use strict';
|
285 |
+
* const { spawn } = require('node:child_process');
|
286 |
+
*
|
287 |
+
* const subprocess = spawn(
|
288 |
+
* 'sh',
|
289 |
+
* [
|
290 |
+
* '-c',
|
291 |
+
* `node -e "setInterval(() => {
|
292 |
+
* console.log(process.pid, 'is alive')
|
293 |
+
* }, 500);"`,
|
294 |
+
* ], {
|
295 |
+
* stdio: ['inherit', 'inherit', 'inherit'],
|
296 |
+
* },
|
297 |
+
* );
|
298 |
+
*
|
299 |
+
* setTimeout(() => {
|
300 |
+
* subprocess.kill(); // Does not terminate the Node.js process in the shell.
|
301 |
+
* }, 2000);
|
302 |
+
* ```
|
303 |
+
* @since v0.1.90
|
304 |
+
*/
|
305 |
+
kill(signal?: NodeJS.Signals | number): boolean;
|
306 |
+
/**
|
307 |
+
* Calls {@link ChildProcess.kill} with `'SIGTERM'`.
|
308 |
+
* @since v20.5.0
|
309 |
+
*/
|
310 |
+
[Symbol.dispose](): void;
|
311 |
+
/**
|
312 |
+
* When an IPC channel has been established between the parent and child (
|
313 |
+
* i.e. when using {@link fork}), the `subprocess.send()` method can
|
314 |
+
* be used to send messages to the child process. When the child process is a
|
315 |
+
* Node.js instance, these messages can be received via the `'message'` event.
|
316 |
+
*
|
317 |
+
* The message goes through serialization and parsing. The resulting
|
318 |
+
* message might not be the same as what is originally sent.
|
319 |
+
*
|
320 |
+
* For example, in the parent script:
|
321 |
+
*
|
322 |
+
* ```js
|
323 |
+
* const cp = require('node:child_process');
|
324 |
+
* const n = cp.fork(`${__dirname}/sub.js`);
|
325 |
+
*
|
326 |
+
* n.on('message', (m) => {
|
327 |
+
* console.log('PARENT got message:', m);
|
328 |
+
* });
|
329 |
+
*
|
330 |
+
* // Causes the child to print: CHILD got message: { hello: 'world' }
|
331 |
+
* n.send({ hello: 'world' });
|
332 |
+
* ```
|
333 |
+
*
|
334 |
+
* And then the child script, `'sub.js'` might look like this:
|
335 |
+
*
|
336 |
+
* ```js
|
337 |
+
* process.on('message', (m) => {
|
338 |
+
* console.log('CHILD got message:', m);
|
339 |
+
* });
|
340 |
+
*
|
341 |
+
* // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null }
|
342 |
+
* process.send({ foo: 'bar', baz: NaN });
|
343 |
+
* ```
|
344 |
+
*
|
345 |
+
* Child Node.js processes will have a `process.send()` method of their own
|
346 |
+
* that allows the child to send messages back to the parent.
|
347 |
+
*
|
348 |
+
* There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
|
349 |
+
* containing a `NODE_` prefix in the `cmd` property are reserved for use within
|
350 |
+
* Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the `'internalMessage'` event and are consumed internally by Node.js.
|
351 |
+
* Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice.
|
352 |
+
*
|
353 |
+
* The optional `sendHandle` argument that may be passed to `subprocess.send()` is
|
354 |
+
* for passing a TCP server or socket object to the child process. The child will
|
355 |
+
* receive the object as the second argument passed to the callback function
|
356 |
+
* registered on the `'message'` event. Any data that is received and buffered in
|
357 |
+
* the socket will not be sent to the child. Sending IPC sockets is not supported on Windows.
|
358 |
+
*
|
359 |
+
* The optional `callback` is a function that is invoked after the message is
|
360 |
+
* sent but before the child may have received it. The function is called with a
|
361 |
+
* single argument: `null` on success, or an `Error` object on failure.
|
362 |
+
*
|
363 |
+
* If no `callback` function is provided and the message cannot be sent, an `'error'` event will be emitted by the `ChildProcess` object. This can
|
364 |
+
* happen, for instance, when the child process has already exited.
|
365 |
+
*
|
366 |
+
* `subprocess.send()` will return `false` if the channel has closed or when the
|
367 |
+
* backlog of unsent messages exceeds a threshold that makes it unwise to send
|
368 |
+
* more. Otherwise, the method returns `true`. The `callback` function can be
|
369 |
+
* used to implement flow control.
|
370 |
+
*
|
371 |
+
* #### Example: sending a server object
|
372 |
+
*
|
373 |
+
* The `sendHandle` argument can be used, for instance, to pass the handle of
|
374 |
+
* a TCP server object to the child process as illustrated in the example below:
|
375 |
+
*
|
376 |
+
* ```js
|
377 |
+
* const subprocess = require('node:child_process').fork('subprocess.js');
|
378 |
+
*
|
379 |
+
* // Open up the server object and send the handle.
|
380 |
+
* const server = require('node:net').createServer();
|
381 |
+
* server.on('connection', (socket) => {
|
382 |
+
* socket.end('handled by parent');
|
383 |
+
* });
|
384 |
+
* server.listen(1337, () => {
|
385 |
+
* subprocess.send('server', server);
|
386 |
+
* });
|
387 |
+
* ```
|
388 |
+
*
|
389 |
+
* The child would then receive the server object as:
|
390 |
+
*
|
391 |
+
* ```js
|
392 |
+
* process.on('message', (m, server) => {
|
393 |
+
* if (m === 'server') {
|
394 |
+
* server.on('connection', (socket) => {
|
395 |
+
* socket.end('handled by child');
|
396 |
+
* });
|
397 |
+
* }
|
398 |
+
* });
|
399 |
+
* ```
|
400 |
+
*
|
401 |
+
* Once the server is now shared between the parent and child, some connections
|
402 |
+
* can be handled by the parent and some by the child.
|
403 |
+
*
|
404 |
+
* While the example above uses a server created using the `node:net` module, `node:dgram` module servers use exactly the same workflow with the exceptions of
|
405 |
+
* listening on a `'message'` event instead of `'connection'` and using `server.bind()` instead of `server.listen()`. This is, however, only
|
406 |
+
* supported on Unix platforms.
|
407 |
+
*
|
408 |
+
* #### Example: sending a socket object
|
409 |
+
*
|
410 |
+
* Similarly, the `sendHandler` argument can be used to pass the handle of a
|
411 |
+
* socket to the child process. The example below spawns two children that each
|
412 |
+
* handle connections with "normal" or "special" priority:
|
413 |
+
*
|
414 |
+
* ```js
|
415 |
+
* const { fork } = require('node:child_process');
|
416 |
+
* const normal = fork('subprocess.js', ['normal']);
|
417 |
+
* const special = fork('subprocess.js', ['special']);
|
418 |
+
*
|
419 |
+
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
|
420 |
+
* // the sockets from being read before they are sent to the child process.
|
421 |
+
* const server = require('node:net').createServer({ pauseOnConnect: true });
|
422 |
+
* server.on('connection', (socket) => {
|
423 |
+
*
|
424 |
+
* // If this is special priority...
|
425 |
+
* if (socket.remoteAddress === '74.125.127.100') {
|
426 |
+
* special.send('socket', socket);
|
427 |
+
* return;
|
428 |
+
* }
|
429 |
+
* // This is normal priority.
|
430 |
+
* normal.send('socket', socket);
|
431 |
+
* });
|
432 |
+
* server.listen(1337);
|
433 |
+
* ```
|
434 |
+
*
|
435 |
+
* The `subprocess.js` would receive the socket handle as the second argument
|
436 |
+
* passed to the event callback function:
|
437 |
+
*
|
438 |
+
* ```js
|
439 |
+
* process.on('message', (m, socket) => {
|
440 |
+
* if (m === 'socket') {
|
441 |
+
* if (socket) {
|
442 |
+
* // Check that the client socket exists.
|
443 |
+
* // It is possible for the socket to be closed between the time it is
|
444 |
+
* // sent and the time it is received in the child process.
|
445 |
+
* socket.end(`Request handled with ${process.argv[2]} priority`);
|
446 |
+
* }
|
447 |
+
* }
|
448 |
+
* });
|
449 |
+
* ```
|
450 |
+
*
|
451 |
+
* Do not use `.maxConnections` on a socket that has been passed to a subprocess.
|
452 |
+
* The parent cannot track when the socket is destroyed.
|
453 |
+
*
|
454 |
+
* Any `'message'` handlers in the subprocess should verify that `socket` exists,
|
455 |
+
* as the connection may have been closed during the time it takes to send the
|
456 |
+
* connection to the child.
|
457 |
+
* @since v0.5.9
|
458 |
+
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v22.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v22.x/api/dgram.html#class-dgramsocket) object.
|
459 |
+
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
460 |
+
*/
|
461 |
+
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
462 |
+
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
463 |
+
send(
|
464 |
+
message: Serializable,
|
465 |
+
sendHandle?: SendHandle,
|
466 |
+
options?: MessageOptions,
|
467 |
+
callback?: (error: Error | null) => void,
|
468 |
+
): boolean;
|
469 |
+
/**
|
470 |
+
* Closes the IPC channel between parent and child, allowing the child to exit
|
471 |
+
* gracefully once there are no other connections keeping it alive. After calling
|
472 |
+
* this method the `subprocess.connected` and `process.connected` properties in
|
473 |
+
* both the parent and child (respectively) will be set to `false`, and it will be
|
474 |
+
* no longer possible to pass messages between the processes.
|
475 |
+
*
|
476 |
+
* The `'disconnect'` event will be emitted when there are no messages in the
|
477 |
+
* process of being received. This will most often be triggered immediately after
|
478 |
+
* calling `subprocess.disconnect()`.
|
479 |
+
*
|
480 |
+
* When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked
|
481 |
+
* within the child process to close the IPC channel as well.
|
482 |
+
* @since v0.7.2
|
483 |
+
*/
|
484 |
+
disconnect(): void;
|
485 |
+
/**
|
486 |
+
* By default, the parent will wait for the detached child to exit. To prevent the
|
487 |
+
* parent from waiting for a given `subprocess` to exit, use the `subprocess.unref()` method. Doing so will cause the parent's event loop to not
|
488 |
+
* include the child in its reference count, allowing the parent to exit
|
489 |
+
* independently of the child, unless there is an established IPC channel between
|
490 |
+
* the child and the parent.
|
491 |
+
*
|
492 |
+
* ```js
|
493 |
+
* const { spawn } = require('node:child_process');
|
494 |
+
*
|
495 |
+
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
496 |
+
* detached: true,
|
497 |
+
* stdio: 'ignore',
|
498 |
+
* });
|
499 |
+
*
|
500 |
+
* subprocess.unref();
|
501 |
+
* ```
|
502 |
+
* @since v0.7.10
|
503 |
+
*/
|
504 |
+
unref(): void;
|
505 |
+
/**
|
506 |
+
* Calling `subprocess.ref()` after making a call to `subprocess.unref()` will
|
507 |
+
* restore the removed reference count for the child process, forcing the parent
|
508 |
+
* to wait for the child to exit before exiting itself.
|
509 |
+
*
|
510 |
+
* ```js
|
511 |
+
* const { spawn } = require('node:child_process');
|
512 |
+
*
|
513 |
+
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
514 |
+
* detached: true,
|
515 |
+
* stdio: 'ignore',
|
516 |
+
* });
|
517 |
+
*
|
518 |
+
* subprocess.unref();
|
519 |
+
* subprocess.ref();
|
520 |
+
* ```
|
521 |
+
* @since v0.7.10
|
522 |
+
*/
|
523 |
+
ref(): void;
|
524 |
+
/**
|
525 |
+
* events.EventEmitter
|
526 |
+
* 1. close
|
527 |
+
* 2. disconnect
|
528 |
+
* 3. error
|
529 |
+
* 4. exit
|
530 |
+
* 5. message
|
531 |
+
* 6. spawn
|
532 |
+
*/
|
533 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
534 |
+
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
535 |
+
addListener(event: "disconnect", listener: () => void): this;
|
536 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
537 |
+
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
538 |
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
539 |
+
addListener(event: "spawn", listener: () => void): this;
|
540 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
541 |
+
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
542 |
+
emit(event: "disconnect"): boolean;
|
543 |
+
emit(event: "error", err: Error): boolean;
|
544 |
+
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
545 |
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
546 |
+
emit(event: "spawn", listener: () => void): boolean;
|
547 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
548 |
+
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
549 |
+
on(event: "disconnect", listener: () => void): this;
|
550 |
+
on(event: "error", listener: (err: Error) => void): this;
|
551 |
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
552 |
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
553 |
+
on(event: "spawn", listener: () => void): this;
|
554 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
555 |
+
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
556 |
+
once(event: "disconnect", listener: () => void): this;
|
557 |
+
once(event: "error", listener: (err: Error) => void): this;
|
558 |
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
559 |
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
560 |
+
once(event: "spawn", listener: () => void): this;
|
561 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
562 |
+
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
563 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
564 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
565 |
+
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
566 |
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
567 |
+
prependListener(event: "spawn", listener: () => void): this;
|
568 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
569 |
+
prependOnceListener(
|
570 |
+
event: "close",
|
571 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
572 |
+
): this;
|
573 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
574 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
575 |
+
prependOnceListener(
|
576 |
+
event: "exit",
|
577 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
578 |
+
): this;
|
579 |
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
580 |
+
prependOnceListener(event: "spawn", listener: () => void): this;
|
581 |
+
}
|
582 |
+
// return this object when stdio option is undefined or not specified
|
583 |
+
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
584 |
+
stdin: Writable;
|
585 |
+
stdout: Readable;
|
586 |
+
stderr: Readable;
|
587 |
+
readonly stdio: [
|
588 |
+
Writable,
|
589 |
+
Readable,
|
590 |
+
Readable,
|
591 |
+
// stderr
|
592 |
+
Readable | Writable | null | undefined,
|
593 |
+
// extra, no modification
|
594 |
+
Readable | Writable | null | undefined, // extra, no modification
|
595 |
+
];
|
596 |
+
}
|
597 |
+
// return this object when stdio option is a tuple of 3
|
598 |
+
interface ChildProcessByStdio<I extends null | Writable, O extends null | Readable, E extends null | Readable>
|
599 |
+
extends ChildProcess
|
600 |
+
{
|
601 |
+
stdin: I;
|
602 |
+
stdout: O;
|
603 |
+
stderr: E;
|
604 |
+
readonly stdio: [
|
605 |
+
I,
|
606 |
+
O,
|
607 |
+
E,
|
608 |
+
Readable | Writable | null | undefined,
|
609 |
+
// extra, no modification
|
610 |
+
Readable | Writable | null | undefined, // extra, no modification
|
611 |
+
];
|
612 |
+
}
|
613 |
+
interface MessageOptions {
|
614 |
+
keepOpen?: boolean | undefined;
|
615 |
+
}
|
616 |
+
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
617 |
+
type StdioOptions = IOType | Array<IOType | "ipc" | Stream | number | null | undefined>;
|
618 |
+
type SerializationType = "json" | "advanced";
|
619 |
+
interface MessagingOptions extends Abortable {
|
620 |
+
/**
|
621 |
+
* Specify the kind of serialization used for sending messages between processes.
|
622 |
+
* @default 'json'
|
623 |
+
*/
|
624 |
+
serialization?: SerializationType | undefined;
|
625 |
+
/**
|
626 |
+
* The signal value to be used when the spawned process will be killed by the abort signal.
|
627 |
+
* @default 'SIGTERM'
|
628 |
+
*/
|
629 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
630 |
+
/**
|
631 |
+
* In milliseconds the maximum amount of time the process is allowed to run.
|
632 |
+
*/
|
633 |
+
timeout?: number | undefined;
|
634 |
+
}
|
635 |
+
interface ProcessEnvOptions {
|
636 |
+
uid?: number | undefined;
|
637 |
+
gid?: number | undefined;
|
638 |
+
cwd?: string | URL | undefined;
|
639 |
+
env?: NodeJS.ProcessEnv | undefined;
|
640 |
+
}
|
641 |
+
interface CommonOptions extends ProcessEnvOptions {
|
642 |
+
/**
|
643 |
+
* @default false
|
644 |
+
*/
|
645 |
+
windowsHide?: boolean | undefined;
|
646 |
+
/**
|
647 |
+
* @default 0
|
648 |
+
*/
|
649 |
+
timeout?: number | undefined;
|
650 |
+
}
|
651 |
+
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
652 |
+
argv0?: string | undefined;
|
653 |
+
/**
|
654 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
655 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
656 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
657 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
658 |
+
* {@link ChildProcess.stdio} for more information.
|
659 |
+
*
|
660 |
+
* @default 'pipe'
|
661 |
+
*/
|
662 |
+
stdio?: StdioOptions | undefined;
|
663 |
+
shell?: boolean | string | undefined;
|
664 |
+
windowsVerbatimArguments?: boolean | undefined;
|
665 |
+
}
|
666 |
+
interface SpawnOptions extends CommonSpawnOptions {
|
667 |
+
detached?: boolean | undefined;
|
668 |
+
}
|
669 |
+
interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
670 |
+
stdio?: StdioPipeNamed | StdioPipe[] | undefined;
|
671 |
+
}
|
672 |
+
type StdioNull = "inherit" | "ignore" | Stream;
|
673 |
+
type StdioPipeNamed = "pipe" | "overlapped";
|
674 |
+
type StdioPipe = undefined | null | StdioPipeNamed;
|
675 |
+
interface SpawnOptionsWithStdioTuple<
|
676 |
+
Stdin extends StdioNull | StdioPipe,
|
677 |
+
Stdout extends StdioNull | StdioPipe,
|
678 |
+
Stderr extends StdioNull | StdioPipe,
|
679 |
+
> extends SpawnOptions {
|
680 |
+
stdio: [Stdin, Stdout, Stderr];
|
681 |
+
}
|
682 |
+
/**
|
683 |
+
* The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults
|
684 |
+
* to an empty array.
|
685 |
+
*
|
686 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
687 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
688 |
+
* **arbitrary command execution.**
|
689 |
+
*
|
690 |
+
* A third argument may be used to specify additional options, with these defaults:
|
691 |
+
*
|
692 |
+
* ```js
|
693 |
+
* const defaults = {
|
694 |
+
* cwd: undefined,
|
695 |
+
* env: process.env,
|
696 |
+
* };
|
697 |
+
* ```
|
698 |
+
*
|
699 |
+
* Use `cwd` to specify the working directory from which the process is spawned.
|
700 |
+
* If not given, the default is to inherit the current working directory. If given,
|
701 |
+
* but the path does not exist, the child process emits an `ENOENT` error
|
702 |
+
* and exits immediately. `ENOENT` is also emitted when the command
|
703 |
+
* does not exist.
|
704 |
+
*
|
705 |
+
* Use `env` to specify environment variables that will be visible to the new
|
706 |
+
* process, the default is `process.env`.
|
707 |
+
*
|
708 |
+
* `undefined` values in `env` will be ignored.
|
709 |
+
*
|
710 |
+
* Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the
|
711 |
+
* exit code:
|
712 |
+
*
|
713 |
+
* ```js
|
714 |
+
* const { spawn } = require('node:child_process');
|
715 |
+
* const ls = spawn('ls', ['-lh', '/usr']);
|
716 |
+
*
|
717 |
+
* ls.stdout.on('data', (data) => {
|
718 |
+
* console.log(`stdout: ${data}`);
|
719 |
+
* });
|
720 |
+
*
|
721 |
+
* ls.stderr.on('data', (data) => {
|
722 |
+
* console.error(`stderr: ${data}`);
|
723 |
+
* });
|
724 |
+
*
|
725 |
+
* ls.on('close', (code) => {
|
726 |
+
* console.log(`child process exited with code ${code}`);
|
727 |
+
* });
|
728 |
+
* ```
|
729 |
+
*
|
730 |
+
* Example: A very elaborate way to run `ps ax | grep ssh`
|
731 |
+
*
|
732 |
+
* ```js
|
733 |
+
* const { spawn } = require('node:child_process');
|
734 |
+
* const ps = spawn('ps', ['ax']);
|
735 |
+
* const grep = spawn('grep', ['ssh']);
|
736 |
+
*
|
737 |
+
* ps.stdout.on('data', (data) => {
|
738 |
+
* grep.stdin.write(data);
|
739 |
+
* });
|
740 |
+
*
|
741 |
+
* ps.stderr.on('data', (data) => {
|
742 |
+
* console.error(`ps stderr: ${data}`);
|
743 |
+
* });
|
744 |
+
*
|
745 |
+
* ps.on('close', (code) => {
|
746 |
+
* if (code !== 0) {
|
747 |
+
* console.log(`ps process exited with code ${code}`);
|
748 |
+
* }
|
749 |
+
* grep.stdin.end();
|
750 |
+
* });
|
751 |
+
*
|
752 |
+
* grep.stdout.on('data', (data) => {
|
753 |
+
* console.log(data.toString());
|
754 |
+
* });
|
755 |
+
*
|
756 |
+
* grep.stderr.on('data', (data) => {
|
757 |
+
* console.error(`grep stderr: ${data}`);
|
758 |
+
* });
|
759 |
+
*
|
760 |
+
* grep.on('close', (code) => {
|
761 |
+
* if (code !== 0) {
|
762 |
+
* console.log(`grep process exited with code ${code}`);
|
763 |
+
* }
|
764 |
+
* });
|
765 |
+
* ```
|
766 |
+
*
|
767 |
+
* Example of checking for failed `spawn`:
|
768 |
+
*
|
769 |
+
* ```js
|
770 |
+
* const { spawn } = require('node:child_process');
|
771 |
+
* const subprocess = spawn('bad_command');
|
772 |
+
*
|
773 |
+
* subprocess.on('error', (err) => {
|
774 |
+
* console.error('Failed to start subprocess.');
|
775 |
+
* });
|
776 |
+
* ```
|
777 |
+
*
|
778 |
+
* Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
|
779 |
+
* title while others (Windows, SunOS) will use `command`.
|
780 |
+
*
|
781 |
+
* Node.js overwrites `argv[0]` with `process.execPath` on startup, so `process.argv[0]` in a Node.js child process will not match the `argv0` parameter passed to `spawn` from the parent. Retrieve
|
782 |
+
* it with the `process.argv0` property instead.
|
783 |
+
*
|
784 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
785 |
+
* the error passed to the callback will be an `AbortError`:
|
786 |
+
*
|
787 |
+
* ```js
|
788 |
+
* const { spawn } = require('node:child_process');
|
789 |
+
* const controller = new AbortController();
|
790 |
+
* const { signal } = controller;
|
791 |
+
* const grep = spawn('grep', ['ssh'], { signal });
|
792 |
+
* grep.on('error', (err) => {
|
793 |
+
* // This will be called with err being an AbortError if the controller aborts
|
794 |
+
* });
|
795 |
+
* controller.abort(); // Stops the child process
|
796 |
+
* ```
|
797 |
+
* @since v0.1.90
|
798 |
+
* @param command The command to run.
|
799 |
+
* @param args List of string arguments.
|
800 |
+
*/
|
801 |
+
function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
802 |
+
function spawn(
|
803 |
+
command: string,
|
804 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
805 |
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
806 |
+
function spawn(
|
807 |
+
command: string,
|
808 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
809 |
+
): ChildProcessByStdio<Writable, Readable, null>;
|
810 |
+
function spawn(
|
811 |
+
command: string,
|
812 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
813 |
+
): ChildProcessByStdio<Writable, null, Readable>;
|
814 |
+
function spawn(
|
815 |
+
command: string,
|
816 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
817 |
+
): ChildProcessByStdio<null, Readable, Readable>;
|
818 |
+
function spawn(
|
819 |
+
command: string,
|
820 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
821 |
+
): ChildProcessByStdio<Writable, null, null>;
|
822 |
+
function spawn(
|
823 |
+
command: string,
|
824 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
825 |
+
): ChildProcessByStdio<null, Readable, null>;
|
826 |
+
function spawn(
|
827 |
+
command: string,
|
828 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
829 |
+
): ChildProcessByStdio<null, null, Readable>;
|
830 |
+
function spawn(
|
831 |
+
command: string,
|
832 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
833 |
+
): ChildProcessByStdio<null, null, null>;
|
834 |
+
function spawn(command: string, options: SpawnOptions): ChildProcess;
|
835 |
+
// overloads of spawn with 'args'
|
836 |
+
function spawn(
|
837 |
+
command: string,
|
838 |
+
args?: readonly string[],
|
839 |
+
options?: SpawnOptionsWithoutStdio,
|
840 |
+
): ChildProcessWithoutNullStreams;
|
841 |
+
function spawn(
|
842 |
+
command: string,
|
843 |
+
args: readonly string[],
|
844 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
845 |
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
846 |
+
function spawn(
|
847 |
+
command: string,
|
848 |
+
args: readonly string[],
|
849 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
850 |
+
): ChildProcessByStdio<Writable, Readable, null>;
|
851 |
+
function spawn(
|
852 |
+
command: string,
|
853 |
+
args: readonly string[],
|
854 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
855 |
+
): ChildProcessByStdio<Writable, null, Readable>;
|
856 |
+
function spawn(
|
857 |
+
command: string,
|
858 |
+
args: readonly string[],
|
859 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
860 |
+
): ChildProcessByStdio<null, Readable, Readable>;
|
861 |
+
function spawn(
|
862 |
+
command: string,
|
863 |
+
args: readonly string[],
|
864 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
865 |
+
): ChildProcessByStdio<Writable, null, null>;
|
866 |
+
function spawn(
|
867 |
+
command: string,
|
868 |
+
args: readonly string[],
|
869 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
870 |
+
): ChildProcessByStdio<null, Readable, null>;
|
871 |
+
function spawn(
|
872 |
+
command: string,
|
873 |
+
args: readonly string[],
|
874 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
875 |
+
): ChildProcessByStdio<null, null, Readable>;
|
876 |
+
function spawn(
|
877 |
+
command: string,
|
878 |
+
args: readonly string[],
|
879 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
880 |
+
): ChildProcessByStdio<null, null, null>;
|
881 |
+
function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
|
882 |
+
interface ExecOptions extends CommonOptions {
|
883 |
+
shell?: string | undefined;
|
884 |
+
signal?: AbortSignal | undefined;
|
885 |
+
maxBuffer?: number | undefined;
|
886 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
887 |
+
}
|
888 |
+
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
889 |
+
encoding: BufferEncoding;
|
890 |
+
}
|
891 |
+
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
892 |
+
encoding: BufferEncoding | null; // specify `null`.
|
893 |
+
}
|
894 |
+
interface ExecException extends Error {
|
895 |
+
cmd?: string | undefined;
|
896 |
+
killed?: boolean | undefined;
|
897 |
+
code?: number | undefined;
|
898 |
+
signal?: NodeJS.Signals | undefined;
|
899 |
+
stdout?: string;
|
900 |
+
stderr?: string;
|
901 |
+
}
|
902 |
+
/**
|
903 |
+
* Spawns a shell then executes the `command` within that shell, buffering any
|
904 |
+
* generated output. The `command` string passed to the exec function is processed
|
905 |
+
* directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
|
906 |
+
* need to be dealt with accordingly:
|
907 |
+
*
|
908 |
+
* ```js
|
909 |
+
* const { exec } = require('node:child_process');
|
910 |
+
*
|
911 |
+
* exec('"/path/to/test file/test.sh" arg1 arg2');
|
912 |
+
* // Double quotes are used so that the space in the path is not interpreted as
|
913 |
+
* // a delimiter of multiple arguments.
|
914 |
+
*
|
915 |
+
* exec('echo "The \\$HOME variable is $HOME"');
|
916 |
+
* // The $HOME variable is escaped in the first instance, but not in the second.
|
917 |
+
* ```
|
918 |
+
*
|
919 |
+
* **Never pass unsanitized user input to this function. Any input containing shell**
|
920 |
+
* **metacharacters may be used to trigger arbitrary command execution.**
|
921 |
+
*
|
922 |
+
* If a `callback` function is provided, it is called with the arguments `(error, stdout, stderr)`. On success, `error` will be `null`. On error, `error` will be an instance of `Error`. The
|
923 |
+
* `error.code` property will be
|
924 |
+
* the exit code of the process. By convention, any exit code other than `0` indicates an error. `error.signal` will be the signal that terminated the
|
925 |
+
* process.
|
926 |
+
*
|
927 |
+
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
928 |
+
* stdout and stderr output of the child process. By default, Node.js will decode
|
929 |
+
* the output as UTF-8 and pass strings to the callback. The `encoding` option
|
930 |
+
* can be used to specify the character encoding used to decode the stdout and
|
931 |
+
* stderr output. If `encoding` is `'buffer'`, or an unrecognized character
|
932 |
+
* encoding, `Buffer` objects will be passed to the callback instead.
|
933 |
+
*
|
934 |
+
* ```js
|
935 |
+
* const { exec } = require('node:child_process');
|
936 |
+
* exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
|
937 |
+
* if (error) {
|
938 |
+
* console.error(`exec error: ${error}`);
|
939 |
+
* return;
|
940 |
+
* }
|
941 |
+
* console.log(`stdout: ${stdout}`);
|
942 |
+
* console.error(`stderr: ${stderr}`);
|
943 |
+
* });
|
944 |
+
* ```
|
945 |
+
*
|
946 |
+
* If `timeout` is greater than `0`, the parent will send the signal
|
947 |
+
* identified by the `killSignal` property (the default is `'SIGTERM'`) if the
|
948 |
+
* child runs longer than `timeout` milliseconds.
|
949 |
+
*
|
950 |
+
* Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace
|
951 |
+
* the existing process and uses a shell to execute the command.
|
952 |
+
*
|
953 |
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
954 |
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
955 |
+
* case of an error (including any error resulting in an exit code other than 0), a
|
956 |
+
* rejected promise is returned, with the same `error` object given in the
|
957 |
+
* callback, but with two additional properties `stdout` and `stderr`.
|
958 |
+
*
|
959 |
+
* ```js
|
960 |
+
* const util = require('node:util');
|
961 |
+
* const exec = util.promisify(require('node:child_process').exec);
|
962 |
+
*
|
963 |
+
* async function lsExample() {
|
964 |
+
* const { stdout, stderr } = await exec('ls');
|
965 |
+
* console.log('stdout:', stdout);
|
966 |
+
* console.error('stderr:', stderr);
|
967 |
+
* }
|
968 |
+
* lsExample();
|
969 |
+
* ```
|
970 |
+
*
|
971 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
972 |
+
* the error passed to the callback will be an `AbortError`:
|
973 |
+
*
|
974 |
+
* ```js
|
975 |
+
* const { exec } = require('node:child_process');
|
976 |
+
* const controller = new AbortController();
|
977 |
+
* const { signal } = controller;
|
978 |
+
* const child = exec('grep ssh', { signal }, (error) => {
|
979 |
+
* console.error(error); // an AbortError
|
980 |
+
* });
|
981 |
+
* controller.abort();
|
982 |
+
* ```
|
983 |
+
* @since v0.1.90
|
984 |
+
* @param command The command to run, with space-separated arguments.
|
985 |
+
* @param callback called with the output when process terminates.
|
986 |
+
*/
|
987 |
+
function exec(
|
988 |
+
command: string,
|
989 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
990 |
+
): ChildProcess;
|
991 |
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
992 |
+
function exec(
|
993 |
+
command: string,
|
994 |
+
options: {
|
995 |
+
encoding: "buffer" | null;
|
996 |
+
} & ExecOptions,
|
997 |
+
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
998 |
+
): ChildProcess;
|
999 |
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
1000 |
+
function exec(
|
1001 |
+
command: string,
|
1002 |
+
options: {
|
1003 |
+
encoding: BufferEncoding;
|
1004 |
+
} & ExecOptions,
|
1005 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
1006 |
+
): ChildProcess;
|
1007 |
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
1008 |
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
1009 |
+
function exec(
|
1010 |
+
command: string,
|
1011 |
+
options: {
|
1012 |
+
encoding: BufferEncoding;
|
1013 |
+
} & ExecOptions,
|
1014 |
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1015 |
+
): ChildProcess;
|
1016 |
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
1017 |
+
function exec(
|
1018 |
+
command: string,
|
1019 |
+
options: ExecOptions,
|
1020 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
1021 |
+
): ChildProcess;
|
1022 |
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
1023 |
+
function exec(
|
1024 |
+
command: string,
|
1025 |
+
options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
|
1026 |
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1027 |
+
): ChildProcess;
|
1028 |
+
interface PromiseWithChild<T> extends Promise<T> {
|
1029 |
+
child: ChildProcess;
|
1030 |
+
}
|
1031 |
+
namespace exec {
|
1032 |
+
function __promisify__(command: string): PromiseWithChild<{
|
1033 |
+
stdout: string;
|
1034 |
+
stderr: string;
|
1035 |
+
}>;
|
1036 |
+
function __promisify__(
|
1037 |
+
command: string,
|
1038 |
+
options: {
|
1039 |
+
encoding: "buffer" | null;
|
1040 |
+
} & ExecOptions,
|
1041 |
+
): PromiseWithChild<{
|
1042 |
+
stdout: Buffer;
|
1043 |
+
stderr: Buffer;
|
1044 |
+
}>;
|
1045 |
+
function __promisify__(
|
1046 |
+
command: string,
|
1047 |
+
options: {
|
1048 |
+
encoding: BufferEncoding;
|
1049 |
+
} & ExecOptions,
|
1050 |
+
): PromiseWithChild<{
|
1051 |
+
stdout: string;
|
1052 |
+
stderr: string;
|
1053 |
+
}>;
|
1054 |
+
function __promisify__(
|
1055 |
+
command: string,
|
1056 |
+
options: ExecOptions,
|
1057 |
+
): PromiseWithChild<{
|
1058 |
+
stdout: string;
|
1059 |
+
stderr: string;
|
1060 |
+
}>;
|
1061 |
+
function __promisify__(
|
1062 |
+
command: string,
|
1063 |
+
options?: (ObjectEncodingOptions & ExecOptions) | null,
|
1064 |
+
): PromiseWithChild<{
|
1065 |
+
stdout: string | Buffer;
|
1066 |
+
stderr: string | Buffer;
|
1067 |
+
}>;
|
1068 |
+
}
|
1069 |
+
interface ExecFileOptions extends CommonOptions, Abortable {
|
1070 |
+
maxBuffer?: number | undefined;
|
1071 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
1072 |
+
windowsVerbatimArguments?: boolean | undefined;
|
1073 |
+
shell?: boolean | string | undefined;
|
1074 |
+
signal?: AbortSignal | undefined;
|
1075 |
+
}
|
1076 |
+
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
1077 |
+
encoding: BufferEncoding;
|
1078 |
+
}
|
1079 |
+
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
1080 |
+
encoding: "buffer" | null;
|
1081 |
+
}
|
1082 |
+
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
1083 |
+
encoding: BufferEncoding;
|
1084 |
+
}
|
1085 |
+
type ExecFileException =
|
1086 |
+
& Omit<ExecException, "code">
|
1087 |
+
& Omit<NodeJS.ErrnoException, "code">
|
1088 |
+
& { code?: string | number | undefined | null };
|
1089 |
+
/**
|
1090 |
+
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
|
1091 |
+
* executable `file` is spawned directly as a new process making it slightly more
|
1092 |
+
* efficient than {@link exec}.
|
1093 |
+
*
|
1094 |
+
* The same options as {@link exec} are supported. Since a shell is
|
1095 |
+
* not spawned, behaviors such as I/O redirection and file globbing are not
|
1096 |
+
* supported.
|
1097 |
+
*
|
1098 |
+
* ```js
|
1099 |
+
* const { execFile } = require('node:child_process');
|
1100 |
+
* const child = execFile('node', ['--version'], (error, stdout, stderr) => {
|
1101 |
+
* if (error) {
|
1102 |
+
* throw error;
|
1103 |
+
* }
|
1104 |
+
* console.log(stdout);
|
1105 |
+
* });
|
1106 |
+
* ```
|
1107 |
+
*
|
1108 |
+
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
1109 |
+
* stdout and stderr output of the child process. By default, Node.js will decode
|
1110 |
+
* the output as UTF-8 and pass strings to the callback. The `encoding` option
|
1111 |
+
* can be used to specify the character encoding used to decode the stdout and
|
1112 |
+
* stderr output. If `encoding` is `'buffer'`, or an unrecognized character
|
1113 |
+
* encoding, `Buffer` objects will be passed to the callback instead.
|
1114 |
+
*
|
1115 |
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
1116 |
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
1117 |
+
* case of an error (including any error resulting in an exit code other than 0), a
|
1118 |
+
* rejected promise is returned, with the same `error` object given in the
|
1119 |
+
* callback, but with two additional properties `stdout` and `stderr`.
|
1120 |
+
*
|
1121 |
+
* ```js
|
1122 |
+
* const util = require('node:util');
|
1123 |
+
* const execFile = util.promisify(require('node:child_process').execFile);
|
1124 |
+
* async function getVersion() {
|
1125 |
+
* const { stdout } = await execFile('node', ['--version']);
|
1126 |
+
* console.log(stdout);
|
1127 |
+
* }
|
1128 |
+
* getVersion();
|
1129 |
+
* ```
|
1130 |
+
*
|
1131 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
1132 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
1133 |
+
* **arbitrary command execution.**
|
1134 |
+
*
|
1135 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
1136 |
+
* the error passed to the callback will be an `AbortError`:
|
1137 |
+
*
|
1138 |
+
* ```js
|
1139 |
+
* const { execFile } = require('node:child_process');
|
1140 |
+
* const controller = new AbortController();
|
1141 |
+
* const { signal } = controller;
|
1142 |
+
* const child = execFile('node', ['--version'], { signal }, (error) => {
|
1143 |
+
* console.error(error); // an AbortError
|
1144 |
+
* });
|
1145 |
+
* controller.abort();
|
1146 |
+
* ```
|
1147 |
+
* @since v0.1.91
|
1148 |
+
* @param file The name or path of the executable file to run.
|
1149 |
+
* @param args List of string arguments.
|
1150 |
+
* @param callback Called with the output when process terminates.
|
1151 |
+
*/
|
1152 |
+
function execFile(file: string): ChildProcess;
|
1153 |
+
function execFile(
|
1154 |
+
file: string,
|
1155 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1156 |
+
): ChildProcess;
|
1157 |
+
function execFile(file: string, args?: readonly string[] | null): ChildProcess;
|
1158 |
+
function execFile(
|
1159 |
+
file: string,
|
1160 |
+
args: readonly string[] | undefined | null,
|
1161 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1162 |
+
): ChildProcess;
|
1163 |
+
// no `options` definitely means stdout/stderr are `string`.
|
1164 |
+
function execFile(
|
1165 |
+
file: string,
|
1166 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1167 |
+
): ChildProcess;
|
1168 |
+
function execFile(
|
1169 |
+
file: string,
|
1170 |
+
args: readonly string[] | undefined | null,
|
1171 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1172 |
+
): ChildProcess;
|
1173 |
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
1174 |
+
function execFile(
|
1175 |
+
file: string,
|
1176 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1177 |
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
1178 |
+
): ChildProcess;
|
1179 |
+
function execFile(
|
1180 |
+
file: string,
|
1181 |
+
args: readonly string[] | undefined | null,
|
1182 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1183 |
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
1184 |
+
): ChildProcess;
|
1185 |
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
1186 |
+
function execFile(
|
1187 |
+
file: string,
|
1188 |
+
options: ExecFileOptionsWithStringEncoding,
|
1189 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1190 |
+
): ChildProcess;
|
1191 |
+
function execFile(
|
1192 |
+
file: string,
|
1193 |
+
args: readonly string[] | undefined | null,
|
1194 |
+
options: ExecFileOptionsWithStringEncoding,
|
1195 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1196 |
+
): ChildProcess;
|
1197 |
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
1198 |
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
1199 |
+
function execFile(
|
1200 |
+
file: string,
|
1201 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1202 |
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1203 |
+
): ChildProcess;
|
1204 |
+
function execFile(
|
1205 |
+
file: string,
|
1206 |
+
args: readonly string[] | undefined | null,
|
1207 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1208 |
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1209 |
+
): ChildProcess;
|
1210 |
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
1211 |
+
function execFile(
|
1212 |
+
file: string,
|
1213 |
+
options: ExecFileOptions,
|
1214 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1215 |
+
): ChildProcess;
|
1216 |
+
function execFile(
|
1217 |
+
file: string,
|
1218 |
+
args: readonly string[] | undefined | null,
|
1219 |
+
options: ExecFileOptions,
|
1220 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1221 |
+
): ChildProcess;
|
1222 |
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
1223 |
+
function execFile(
|
1224 |
+
file: string,
|
1225 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1226 |
+
callback:
|
1227 |
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
1228 |
+
| undefined
|
1229 |
+
| null,
|
1230 |
+
): ChildProcess;
|
1231 |
+
function execFile(
|
1232 |
+
file: string,
|
1233 |
+
args: readonly string[] | undefined | null,
|
1234 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1235 |
+
callback:
|
1236 |
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
1237 |
+
| undefined
|
1238 |
+
| null,
|
1239 |
+
): ChildProcess;
|
1240 |
+
namespace execFile {
|
1241 |
+
function __promisify__(file: string): PromiseWithChild<{
|
1242 |
+
stdout: string;
|
1243 |
+
stderr: string;
|
1244 |
+
}>;
|
1245 |
+
function __promisify__(
|
1246 |
+
file: string,
|
1247 |
+
args: readonly string[] | undefined | null,
|
1248 |
+
): PromiseWithChild<{
|
1249 |
+
stdout: string;
|
1250 |
+
stderr: string;
|
1251 |
+
}>;
|
1252 |
+
function __promisify__(
|
1253 |
+
file: string,
|
1254 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1255 |
+
): PromiseWithChild<{
|
1256 |
+
stdout: Buffer;
|
1257 |
+
stderr: Buffer;
|
1258 |
+
}>;
|
1259 |
+
function __promisify__(
|
1260 |
+
file: string,
|
1261 |
+
args: readonly string[] | undefined | null,
|
1262 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1263 |
+
): PromiseWithChild<{
|
1264 |
+
stdout: Buffer;
|
1265 |
+
stderr: Buffer;
|
1266 |
+
}>;
|
1267 |
+
function __promisify__(
|
1268 |
+
file: string,
|
1269 |
+
options: ExecFileOptionsWithStringEncoding,
|
1270 |
+
): PromiseWithChild<{
|
1271 |
+
stdout: string;
|
1272 |
+
stderr: string;
|
1273 |
+
}>;
|
1274 |
+
function __promisify__(
|
1275 |
+
file: string,
|
1276 |
+
args: readonly string[] | undefined | null,
|
1277 |
+
options: ExecFileOptionsWithStringEncoding,
|
1278 |
+
): PromiseWithChild<{
|
1279 |
+
stdout: string;
|
1280 |
+
stderr: string;
|
1281 |
+
}>;
|
1282 |
+
function __promisify__(
|
1283 |
+
file: string,
|
1284 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1285 |
+
): PromiseWithChild<{
|
1286 |
+
stdout: string | Buffer;
|
1287 |
+
stderr: string | Buffer;
|
1288 |
+
}>;
|
1289 |
+
function __promisify__(
|
1290 |
+
file: string,
|
1291 |
+
args: readonly string[] | undefined | null,
|
1292 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1293 |
+
): PromiseWithChild<{
|
1294 |
+
stdout: string | Buffer;
|
1295 |
+
stderr: string | Buffer;
|
1296 |
+
}>;
|
1297 |
+
function __promisify__(
|
1298 |
+
file: string,
|
1299 |
+
options: ExecFileOptions,
|
1300 |
+
): PromiseWithChild<{
|
1301 |
+
stdout: string;
|
1302 |
+
stderr: string;
|
1303 |
+
}>;
|
1304 |
+
function __promisify__(
|
1305 |
+
file: string,
|
1306 |
+
args: readonly string[] | undefined | null,
|
1307 |
+
options: ExecFileOptions,
|
1308 |
+
): PromiseWithChild<{
|
1309 |
+
stdout: string;
|
1310 |
+
stderr: string;
|
1311 |
+
}>;
|
1312 |
+
function __promisify__(
|
1313 |
+
file: string,
|
1314 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1315 |
+
): PromiseWithChild<{
|
1316 |
+
stdout: string | Buffer;
|
1317 |
+
stderr: string | Buffer;
|
1318 |
+
}>;
|
1319 |
+
function __promisify__(
|
1320 |
+
file: string,
|
1321 |
+
args: readonly string[] | undefined | null,
|
1322 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1323 |
+
): PromiseWithChild<{
|
1324 |
+
stdout: string | Buffer;
|
1325 |
+
stderr: string | Buffer;
|
1326 |
+
}>;
|
1327 |
+
}
|
1328 |
+
interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
1329 |
+
execPath?: string | undefined;
|
1330 |
+
execArgv?: string[] | undefined;
|
1331 |
+
silent?: boolean | undefined;
|
1332 |
+
/**
|
1333 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
1334 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
1335 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
1336 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
1337 |
+
* {@link ChildProcess.stdio} for more information.
|
1338 |
+
*
|
1339 |
+
* @default 'pipe'
|
1340 |
+
*/
|
1341 |
+
stdio?: StdioOptions | undefined;
|
1342 |
+
detached?: boolean | undefined;
|
1343 |
+
windowsVerbatimArguments?: boolean | undefined;
|
1344 |
+
}
|
1345 |
+
/**
|
1346 |
+
* The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes.
|
1347 |
+
* Like {@link spawn}, a `ChildProcess` object is returned. The
|
1348 |
+
* returned `ChildProcess` will have an additional communication channel
|
1349 |
+
* built-in that allows messages to be passed back and forth between the parent and
|
1350 |
+
* child. See `subprocess.send()` for details.
|
1351 |
+
*
|
1352 |
+
* Keep in mind that spawned Node.js child processes are
|
1353 |
+
* independent of the parent with exception of the IPC communication channel
|
1354 |
+
* that is established between the two. Each process has its own memory, with
|
1355 |
+
* their own V8 instances. Because of the additional resource allocations
|
1356 |
+
* required, spawning a large number of child Node.js processes is not
|
1357 |
+
* recommended.
|
1358 |
+
*
|
1359 |
+
* By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the `options` object allows for an alternative
|
1360 |
+
* execution path to be used.
|
1361 |
+
*
|
1362 |
+
* Node.js processes launched with a custom `execPath` will communicate with the
|
1363 |
+
* parent process using the file descriptor (fd) identified using the
|
1364 |
+
* environment variable `NODE_CHANNEL_FD` on the child process.
|
1365 |
+
*
|
1366 |
+
* Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the
|
1367 |
+
* current process.
|
1368 |
+
*
|
1369 |
+
* The `shell` option available in {@link spawn} is not supported by `child_process.fork()` and will be ignored if set.
|
1370 |
+
*
|
1371 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
1372 |
+
* the error passed to the callback will be an `AbortError`:
|
1373 |
+
*
|
1374 |
+
* ```js
|
1375 |
+
* if (process.argv[2] === 'child') {
|
1376 |
+
* setTimeout(() => {
|
1377 |
+
* console.log(`Hello from ${process.argv[2]}!`);
|
1378 |
+
* }, 1_000);
|
1379 |
+
* } else {
|
1380 |
+
* const { fork } = require('node:child_process');
|
1381 |
+
* const controller = new AbortController();
|
1382 |
+
* const { signal } = controller;
|
1383 |
+
* const child = fork(__filename, ['child'], { signal });
|
1384 |
+
* child.on('error', (err) => {
|
1385 |
+
* // This will be called with err being an AbortError if the controller aborts
|
1386 |
+
* });
|
1387 |
+
* controller.abort(); // Stops the child process
|
1388 |
+
* }
|
1389 |
+
* ```
|
1390 |
+
* @since v0.5.0
|
1391 |
+
* @param modulePath The module to run in the child.
|
1392 |
+
* @param args List of string arguments.
|
1393 |
+
*/
|
1394 |
+
function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
|
1395 |
+
function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
|
1396 |
+
interface SpawnSyncOptions extends CommonSpawnOptions {
|
1397 |
+
input?: string | NodeJS.ArrayBufferView | undefined;
|
1398 |
+
maxBuffer?: number | undefined;
|
1399 |
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
1400 |
+
}
|
1401 |
+
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
1402 |
+
encoding: BufferEncoding;
|
1403 |
+
}
|
1404 |
+
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
1405 |
+
encoding?: "buffer" | null | undefined;
|
1406 |
+
}
|
1407 |
+
interface SpawnSyncReturns<T> {
|
1408 |
+
pid: number;
|
1409 |
+
output: Array<T | null>;
|
1410 |
+
stdout: T;
|
1411 |
+
stderr: T;
|
1412 |
+
status: number | null;
|
1413 |
+
signal: NodeJS.Signals | null;
|
1414 |
+
error?: Error | undefined;
|
1415 |
+
}
|
1416 |
+
/**
|
1417 |
+
* The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
|
1418 |
+
* until the child process has fully closed. When a timeout has been encountered
|
1419 |
+
* and `killSignal` is sent, the method won't return until the process has
|
1420 |
+
* completely exited. If the process intercepts and handles the `SIGTERM` signal
|
1421 |
+
* and doesn't exit, the parent process will wait until the child process has
|
1422 |
+
* exited.
|
1423 |
+
*
|
1424 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
1425 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
1426 |
+
* **arbitrary command execution.**
|
1427 |
+
* @since v0.11.12
|
1428 |
+
* @param command The command to run.
|
1429 |
+
* @param args List of string arguments.
|
1430 |
+
*/
|
1431 |
+
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
1432 |
+
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
1433 |
+
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
1434 |
+
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
1435 |
+
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<Buffer>;
|
1436 |
+
function spawnSync(
|
1437 |
+
command: string,
|
1438 |
+
args: readonly string[],
|
1439 |
+
options: SpawnSyncOptionsWithStringEncoding,
|
1440 |
+
): SpawnSyncReturns<string>;
|
1441 |
+
function spawnSync(
|
1442 |
+
command: string,
|
1443 |
+
args: readonly string[],
|
1444 |
+
options: SpawnSyncOptionsWithBufferEncoding,
|
1445 |
+
): SpawnSyncReturns<Buffer>;
|
1446 |
+
function spawnSync(
|
1447 |
+
command: string,
|
1448 |
+
args?: readonly string[],
|
1449 |
+
options?: SpawnSyncOptions,
|
1450 |
+
): SpawnSyncReturns<string | Buffer>;
|
1451 |
+
interface CommonExecOptions extends CommonOptions {
|
1452 |
+
input?: string | NodeJS.ArrayBufferView | undefined;
|
1453 |
+
/**
|
1454 |
+
* Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
|
1455 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
1456 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
1457 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
1458 |
+
* {@link ChildProcess.stdio} for more information.
|
1459 |
+
*
|
1460 |
+
* @default 'pipe'
|
1461 |
+
*/
|
1462 |
+
stdio?: StdioOptions | undefined;
|
1463 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
1464 |
+
maxBuffer?: number | undefined;
|
1465 |
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
1466 |
+
}
|
1467 |
+
interface ExecSyncOptions extends CommonExecOptions {
|
1468 |
+
shell?: string | undefined;
|
1469 |
+
}
|
1470 |
+
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
1471 |
+
encoding: BufferEncoding;
|
1472 |
+
}
|
1473 |
+
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
1474 |
+
encoding?: "buffer" | null | undefined;
|
1475 |
+
}
|
1476 |
+
/**
|
1477 |
+
* The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
|
1478 |
+
* until the child process has fully closed. When a timeout has been encountered
|
1479 |
+
* and `killSignal` is sent, the method won't return until the process has
|
1480 |
+
* completely exited. If the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process
|
1481 |
+
* has exited.
|
1482 |
+
*
|
1483 |
+
* If the process times out or has a non-zero exit code, this method will throw.
|
1484 |
+
* The `Error` object will contain the entire result from {@link spawnSync}.
|
1485 |
+
*
|
1486 |
+
* **Never pass unsanitized user input to this function. Any input containing shell**
|
1487 |
+
* **metacharacters may be used to trigger arbitrary command execution.**
|
1488 |
+
* @since v0.11.12
|
1489 |
+
* @param command The command to run.
|
1490 |
+
* @return The stdout from the command.
|
1491 |
+
*/
|
1492 |
+
function execSync(command: string): Buffer;
|
1493 |
+
function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
|
1494 |
+
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
|
1495 |
+
function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
|
1496 |
+
interface ExecFileSyncOptions extends CommonExecOptions {
|
1497 |
+
shell?: boolean | string | undefined;
|
1498 |
+
}
|
1499 |
+
interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
1500 |
+
encoding: BufferEncoding;
|
1501 |
+
}
|
1502 |
+
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
1503 |
+
encoding?: "buffer" | null; // specify `null`.
|
1504 |
+
}
|
1505 |
+
/**
|
1506 |
+
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
|
1507 |
+
* return until the child process has fully closed. When a timeout has been
|
1508 |
+
* encountered and `killSignal` is sent, the method won't return until the process
|
1509 |
+
* has completely exited.
|
1510 |
+
*
|
1511 |
+
* If the child process intercepts and handles the `SIGTERM` signal and
|
1512 |
+
* does not exit, the parent process will still wait until the child process has
|
1513 |
+
* exited.
|
1514 |
+
*
|
1515 |
+
* If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}.
|
1516 |
+
*
|
1517 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
1518 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
1519 |
+
* **arbitrary command execution.**
|
1520 |
+
* @since v0.11.12
|
1521 |
+
* @param file The name or path of the executable file to run.
|
1522 |
+
* @param args List of string arguments.
|
1523 |
+
* @return The stdout from the command.
|
1524 |
+
*/
|
1525 |
+
function execFileSync(file: string): Buffer;
|
1526 |
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
|
1527 |
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
1528 |
+
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
|
1529 |
+
function execFileSync(file: string, args: readonly string[]): Buffer;
|
1530 |
+
function execFileSync(
|
1531 |
+
file: string,
|
1532 |
+
args: readonly string[],
|
1533 |
+
options: ExecFileSyncOptionsWithStringEncoding,
|
1534 |
+
): string;
|
1535 |
+
function execFileSync(
|
1536 |
+
file: string,
|
1537 |
+
args: readonly string[],
|
1538 |
+
options: ExecFileSyncOptionsWithBufferEncoding,
|
1539 |
+
): Buffer;
|
1540 |
+
function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
|
1541 |
+
}
|
1542 |
+
declare module "node:child_process" {
|
1543 |
+
export * from "child_process";
|
1544 |
+
}
|
workers1/auto3d/node_modules/@types/node/cluster.d.ts
ADDED
@@ -0,0 +1,578 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
3 |
+
* that can distribute workloads among their application threads. When process isolation
|
4 |
+
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html)
|
5 |
+
* module instead, which allows running multiple application threads within a single Node.js instance.
|
6 |
+
*
|
7 |
+
* The cluster module allows easy creation of child processes that all share
|
8 |
+
* server ports.
|
9 |
+
*
|
10 |
+
* ```js
|
11 |
+
* import cluster from 'node:cluster';
|
12 |
+
* import http from 'node:http';
|
13 |
+
* import { availableParallelism } from 'node:os';
|
14 |
+
* import process from 'node:process';
|
15 |
+
*
|
16 |
+
* const numCPUs = availableParallelism();
|
17 |
+
*
|
18 |
+
* if (cluster.isPrimary) {
|
19 |
+
* console.log(`Primary ${process.pid} is running`);
|
20 |
+
*
|
21 |
+
* // Fork workers.
|
22 |
+
* for (let i = 0; i < numCPUs; i++) {
|
23 |
+
* cluster.fork();
|
24 |
+
* }
|
25 |
+
*
|
26 |
+
* cluster.on('exit', (worker, code, signal) => {
|
27 |
+
* console.log(`worker ${worker.process.pid} died`);
|
28 |
+
* });
|
29 |
+
* } else {
|
30 |
+
* // Workers can share any TCP connection
|
31 |
+
* // In this case it is an HTTP server
|
32 |
+
* http.createServer((req, res) => {
|
33 |
+
* res.writeHead(200);
|
34 |
+
* res.end('hello world\n');
|
35 |
+
* }).listen(8000);
|
36 |
+
*
|
37 |
+
* console.log(`Worker ${process.pid} started`);
|
38 |
+
* }
|
39 |
+
* ```
|
40 |
+
*
|
41 |
+
* Running Node.js will now share port 8000 between the workers:
|
42 |
+
*
|
43 |
+
* ```console
|
44 |
+
* $ node server.js
|
45 |
+
* Primary 3596 is running
|
46 |
+
* Worker 4324 started
|
47 |
+
* Worker 4520 started
|
48 |
+
* Worker 6056 started
|
49 |
+
* Worker 5644 started
|
50 |
+
* ```
|
51 |
+
*
|
52 |
+
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
53 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/cluster.js)
|
54 |
+
*/
|
55 |
+
declare module "cluster" {
|
56 |
+
import * as child from "node:child_process";
|
57 |
+
import EventEmitter = require("node:events");
|
58 |
+
import * as net from "node:net";
|
59 |
+
type SerializationType = "json" | "advanced";
|
60 |
+
export interface ClusterSettings {
|
61 |
+
/**
|
62 |
+
* List of string arguments passed to the Node.js executable.
|
63 |
+
* @default process.execArgv
|
64 |
+
*/
|
65 |
+
execArgv?: string[] | undefined;
|
66 |
+
/**
|
67 |
+
* File path to worker file.
|
68 |
+
* @default process.argv[1]
|
69 |
+
*/
|
70 |
+
exec?: string | undefined;
|
71 |
+
/**
|
72 |
+
* String arguments passed to worker.
|
73 |
+
* @default process.argv.slice(2)
|
74 |
+
*/
|
75 |
+
args?: string[] | undefined;
|
76 |
+
/**
|
77 |
+
* Whether or not to send output to parent's stdio.
|
78 |
+
* @default false
|
79 |
+
*/
|
80 |
+
silent?: boolean | undefined;
|
81 |
+
/**
|
82 |
+
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
|
83 |
+
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processspawncommand-args-options)'s
|
84 |
+
* [`stdio`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#optionsstdio).
|
85 |
+
*/
|
86 |
+
stdio?: any[] | undefined;
|
87 |
+
/**
|
88 |
+
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
|
89 |
+
*/
|
90 |
+
uid?: number | undefined;
|
91 |
+
/**
|
92 |
+
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
|
93 |
+
*/
|
94 |
+
gid?: number | undefined;
|
95 |
+
/**
|
96 |
+
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
|
97 |
+
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
|
98 |
+
*/
|
99 |
+
inspectPort?: number | (() => number) | undefined;
|
100 |
+
/**
|
101 |
+
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
|
102 |
+
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#advanced-serialization) for more details.
|
103 |
+
* @default false
|
104 |
+
*/
|
105 |
+
serialization?: SerializationType | undefined;
|
106 |
+
/**
|
107 |
+
* Current working directory of the worker process.
|
108 |
+
* @default undefined (inherits from parent process)
|
109 |
+
*/
|
110 |
+
cwd?: string | undefined;
|
111 |
+
/**
|
112 |
+
* Hide the forked processes console window that would normally be created on Windows systems.
|
113 |
+
* @default false
|
114 |
+
*/
|
115 |
+
windowsHide?: boolean | undefined;
|
116 |
+
}
|
117 |
+
export interface Address {
|
118 |
+
address: string;
|
119 |
+
port: number;
|
120 |
+
/**
|
121 |
+
* The `addressType` is one of:
|
122 |
+
*
|
123 |
+
* * `4` (TCPv4)
|
124 |
+
* * `6` (TCPv6)
|
125 |
+
* * `-1` (Unix domain socket)
|
126 |
+
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
|
127 |
+
*/
|
128 |
+
addressType: 4 | 6 | -1 | "udp4" | "udp6";
|
129 |
+
}
|
130 |
+
/**
|
131 |
+
* A `Worker` object contains all public information and method about a worker.
|
132 |
+
* In the primary it can be obtained using `cluster.workers`. In a worker
|
133 |
+
* it can be obtained using `cluster.worker`.
|
134 |
+
* @since v0.7.0
|
135 |
+
*/
|
136 |
+
export class Worker extends EventEmitter {
|
137 |
+
/**
|
138 |
+
* Each new worker is given its own unique id, this id is stored in the `id`.
|
139 |
+
*
|
140 |
+
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
|
141 |
+
* @since v0.8.0
|
142 |
+
*/
|
143 |
+
id: number;
|
144 |
+
/**
|
145 |
+
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
|
146 |
+
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
147 |
+
*
|
148 |
+
* See: [Child Process module](https://nodejs.org/docs/latest-v22.x/api/child_process.html#child_processforkmodulepath-args-options).
|
149 |
+
*
|
150 |
+
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
151 |
+
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
152 |
+
* accidental disconnection.
|
153 |
+
* @since v0.7.0
|
154 |
+
*/
|
155 |
+
process: child.ChildProcess;
|
156 |
+
/**
|
157 |
+
* Send a message to a worker or primary, optionally with a handle.
|
158 |
+
*
|
159 |
+
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v22.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
|
160 |
+
*
|
161 |
+
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
|
162 |
+
*
|
163 |
+
* This example will echo back all messages from the primary:
|
164 |
+
*
|
165 |
+
* ```js
|
166 |
+
* if (cluster.isPrimary) {
|
167 |
+
* const worker = cluster.fork();
|
168 |
+
* worker.send('hi there');
|
169 |
+
*
|
170 |
+
* } else if (cluster.isWorker) {
|
171 |
+
* process.on('message', (msg) => {
|
172 |
+
* process.send(msg);
|
173 |
+
* });
|
174 |
+
* }
|
175 |
+
* ```
|
176 |
+
* @since v0.7.0
|
177 |
+
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
178 |
+
*/
|
179 |
+
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
180 |
+
send(
|
181 |
+
message: child.Serializable,
|
182 |
+
sendHandle: child.SendHandle,
|
183 |
+
callback?: (error: Error | null) => void,
|
184 |
+
): boolean;
|
185 |
+
send(
|
186 |
+
message: child.Serializable,
|
187 |
+
sendHandle: child.SendHandle,
|
188 |
+
options?: child.MessageOptions,
|
189 |
+
callback?: (error: Error | null) => void,
|
190 |
+
): boolean;
|
191 |
+
/**
|
192 |
+
* This function will kill the worker. In the primary worker, it does this by
|
193 |
+
* disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
|
194 |
+
*
|
195 |
+
* The `kill()` function kills the worker process without waiting for a graceful
|
196 |
+
* disconnect, it has the same behavior as `worker.process.kill()`.
|
197 |
+
*
|
198 |
+
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
199 |
+
*
|
200 |
+
* In a worker, `process.kill()` exists, but it is not this function;
|
201 |
+
* it is [`kill()`](https://nodejs.org/docs/latest-v22.x/api/process.html#processkillpid-signal).
|
202 |
+
* @since v0.9.12
|
203 |
+
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
204 |
+
*/
|
205 |
+
kill(signal?: string): void;
|
206 |
+
destroy(signal?: string): void;
|
207 |
+
/**
|
208 |
+
* In a worker, this function will close all servers, wait for the `'close'` event
|
209 |
+
* on those servers, and then disconnect the IPC channel.
|
210 |
+
*
|
211 |
+
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
|
212 |
+
*
|
213 |
+
* Causes `.exitedAfterDisconnect` to be set.
|
214 |
+
*
|
215 |
+
* After a server is closed, it will no longer accept new connections,
|
216 |
+
* but connections may be accepted by any other listening worker. Existing
|
217 |
+
* connections will be allowed to close as usual. When no more connections exist,
|
218 |
+
* see `server.close()`, the IPC channel to the worker will close allowing it
|
219 |
+
* to die gracefully.
|
220 |
+
*
|
221 |
+
* The above applies _only_ to server connections, client connections are not
|
222 |
+
* automatically closed by workers, and disconnect does not wait for them to close
|
223 |
+
* before exiting.
|
224 |
+
*
|
225 |
+
* In a worker, `process.disconnect` exists, but it is not this function;
|
226 |
+
* it is `disconnect()`.
|
227 |
+
*
|
228 |
+
* Because long living server connections may block workers from disconnecting, it
|
229 |
+
* may be useful to send a message, so application specific actions may be taken to
|
230 |
+
* close them. It also may be useful to implement a timeout, killing a worker if
|
231 |
+
* the `'disconnect'` event has not been emitted after some time.
|
232 |
+
*
|
233 |
+
* ```js
|
234 |
+
* if (cluster.isPrimary) {
|
235 |
+
* const worker = cluster.fork();
|
236 |
+
* let timeout;
|
237 |
+
*
|
238 |
+
* worker.on('listening', (address) => {
|
239 |
+
* worker.send('shutdown');
|
240 |
+
* worker.disconnect();
|
241 |
+
* timeout = setTimeout(() => {
|
242 |
+
* worker.kill();
|
243 |
+
* }, 2000);
|
244 |
+
* });
|
245 |
+
*
|
246 |
+
* worker.on('disconnect', () => {
|
247 |
+
* clearTimeout(timeout);
|
248 |
+
* });
|
249 |
+
*
|
250 |
+
* } else if (cluster.isWorker) {
|
251 |
+
* const net = require('node:net');
|
252 |
+
* const server = net.createServer((socket) => {
|
253 |
+
* // Connections never end
|
254 |
+
* });
|
255 |
+
*
|
256 |
+
* server.listen(8000);
|
257 |
+
*
|
258 |
+
* process.on('message', (msg) => {
|
259 |
+
* if (msg === 'shutdown') {
|
260 |
+
* // Initiate graceful close of any connections to server
|
261 |
+
* }
|
262 |
+
* });
|
263 |
+
* }
|
264 |
+
* ```
|
265 |
+
* @since v0.7.7
|
266 |
+
* @return A reference to `worker`.
|
267 |
+
*/
|
268 |
+
disconnect(): void;
|
269 |
+
/**
|
270 |
+
* This function returns `true` if the worker is connected to its primary via its
|
271 |
+
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
272 |
+
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
273 |
+
* @since v0.11.14
|
274 |
+
*/
|
275 |
+
isConnected(): boolean;
|
276 |
+
/**
|
277 |
+
* This function returns `true` if the worker's process has terminated (either
|
278 |
+
* because of exiting or being signaled). Otherwise, it returns `false`.
|
279 |
+
*
|
280 |
+
* ```js
|
281 |
+
* import cluster from 'node:cluster';
|
282 |
+
* import http from 'node:http';
|
283 |
+
* import { availableParallelism } from 'node:os';
|
284 |
+
* import process from 'node:process';
|
285 |
+
*
|
286 |
+
* const numCPUs = availableParallelism();
|
287 |
+
*
|
288 |
+
* if (cluster.isPrimary) {
|
289 |
+
* console.log(`Primary ${process.pid} is running`);
|
290 |
+
*
|
291 |
+
* // Fork workers.
|
292 |
+
* for (let i = 0; i < numCPUs; i++) {
|
293 |
+
* cluster.fork();
|
294 |
+
* }
|
295 |
+
*
|
296 |
+
* cluster.on('fork', (worker) => {
|
297 |
+
* console.log('worker is dead:', worker.isDead());
|
298 |
+
* });
|
299 |
+
*
|
300 |
+
* cluster.on('exit', (worker, code, signal) => {
|
301 |
+
* console.log('worker is dead:', worker.isDead());
|
302 |
+
* });
|
303 |
+
* } else {
|
304 |
+
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
305 |
+
* http.createServer((req, res) => {
|
306 |
+
* res.writeHead(200);
|
307 |
+
* res.end(`Current process\n ${process.pid}`);
|
308 |
+
* process.kill(process.pid);
|
309 |
+
* }).listen(8000);
|
310 |
+
* }
|
311 |
+
* ```
|
312 |
+
* @since v0.11.14
|
313 |
+
*/
|
314 |
+
isDead(): boolean;
|
315 |
+
/**
|
316 |
+
* This property is `true` if the worker exited due to `.disconnect()`.
|
317 |
+
* If the worker exited any other way, it is `false`. If the
|
318 |
+
* worker has not exited, it is `undefined`.
|
319 |
+
*
|
320 |
+
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
321 |
+
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
322 |
+
* based on this value.
|
323 |
+
*
|
324 |
+
* ```js
|
325 |
+
* cluster.on('exit', (worker, code, signal) => {
|
326 |
+
* if (worker.exitedAfterDisconnect === true) {
|
327 |
+
* console.log('Oh, it was just voluntary – no need to worry');
|
328 |
+
* }
|
329 |
+
* });
|
330 |
+
*
|
331 |
+
* // kill worker
|
332 |
+
* worker.kill();
|
333 |
+
* ```
|
334 |
+
* @since v6.0.0
|
335 |
+
*/
|
336 |
+
exitedAfterDisconnect: boolean;
|
337 |
+
/**
|
338 |
+
* events.EventEmitter
|
339 |
+
* 1. disconnect
|
340 |
+
* 2. error
|
341 |
+
* 3. exit
|
342 |
+
* 4. listening
|
343 |
+
* 5. message
|
344 |
+
* 6. online
|
345 |
+
*/
|
346 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
347 |
+
addListener(event: "disconnect", listener: () => void): this;
|
348 |
+
addListener(event: "error", listener: (error: Error) => void): this;
|
349 |
+
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
350 |
+
addListener(event: "listening", listener: (address: Address) => void): this;
|
351 |
+
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
352 |
+
addListener(event: "online", listener: () => void): this;
|
353 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
354 |
+
emit(event: "disconnect"): boolean;
|
355 |
+
emit(event: "error", error: Error): boolean;
|
356 |
+
emit(event: "exit", code: number, signal: string): boolean;
|
357 |
+
emit(event: "listening", address: Address): boolean;
|
358 |
+
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
|
359 |
+
emit(event: "online"): boolean;
|
360 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
361 |
+
on(event: "disconnect", listener: () => void): this;
|
362 |
+
on(event: "error", listener: (error: Error) => void): this;
|
363 |
+
on(event: "exit", listener: (code: number, signal: string) => void): this;
|
364 |
+
on(event: "listening", listener: (address: Address) => void): this;
|
365 |
+
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
366 |
+
on(event: "online", listener: () => void): this;
|
367 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
368 |
+
once(event: "disconnect", listener: () => void): this;
|
369 |
+
once(event: "error", listener: (error: Error) => void): this;
|
370 |
+
once(event: "exit", listener: (code: number, signal: string) => void): this;
|
371 |
+
once(event: "listening", listener: (address: Address) => void): this;
|
372 |
+
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
373 |
+
once(event: "online", listener: () => void): this;
|
374 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
375 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
376 |
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
377 |
+
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
378 |
+
prependListener(event: "listening", listener: (address: Address) => void): this;
|
379 |
+
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
380 |
+
prependListener(event: "online", listener: () => void): this;
|
381 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
382 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
383 |
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
384 |
+
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
385 |
+
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
|
386 |
+
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
387 |
+
prependOnceListener(event: "online", listener: () => void): this;
|
388 |
+
}
|
389 |
+
export interface Cluster extends EventEmitter {
|
390 |
+
disconnect(callback?: () => void): void;
|
391 |
+
/**
|
392 |
+
* Spawn a new worker process.
|
393 |
+
*
|
394 |
+
* This can only be called from the primary process.
|
395 |
+
* @param env Key/value pairs to add to worker process environment.
|
396 |
+
* @since v0.6.0
|
397 |
+
*/
|
398 |
+
fork(env?: any): Worker;
|
399 |
+
/** @deprecated since v16.0.0 - use isPrimary. */
|
400 |
+
readonly isMaster: boolean;
|
401 |
+
/**
|
402 |
+
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
|
403 |
+
* is undefined, then `isPrimary` is `true`.
|
404 |
+
* @since v16.0.0
|
405 |
+
*/
|
406 |
+
readonly isPrimary: boolean;
|
407 |
+
/**
|
408 |
+
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
|
409 |
+
* @since v0.6.0
|
410 |
+
*/
|
411 |
+
readonly isWorker: boolean;
|
412 |
+
/**
|
413 |
+
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
|
414 |
+
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings)
|
415 |
+
* is called, whichever comes first.
|
416 |
+
*
|
417 |
+
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
|
418 |
+
* IOCP handles without incurring a large performance hit.
|
419 |
+
*
|
420 |
+
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
|
421 |
+
* @since v0.11.2
|
422 |
+
*/
|
423 |
+
schedulingPolicy: number;
|
424 |
+
/**
|
425 |
+
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings)
|
426 |
+
* (or [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)) this settings object will contain
|
427 |
+
* the settings, including the default values.
|
428 |
+
*
|
429 |
+
* This object is not intended to be changed or set manually.
|
430 |
+
* @since v0.7.1
|
431 |
+
*/
|
432 |
+
readonly settings: ClusterSettings;
|
433 |
+
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clustersetupprimarysettings) instead. */
|
434 |
+
setupMaster(settings?: ClusterSettings): void;
|
435 |
+
/**
|
436 |
+
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
|
437 |
+
*
|
438 |
+
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv)
|
439 |
+
* and have no effect on workers that are already running.
|
440 |
+
*
|
441 |
+
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
|
442 |
+
* [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv).
|
443 |
+
*
|
444 |
+
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
|
445 |
+
* `cluster.setupPrimary()` is called.
|
446 |
+
*
|
447 |
+
* ```js
|
448 |
+
* import cluster from 'node:cluster';
|
449 |
+
*
|
450 |
+
* cluster.setupPrimary({
|
451 |
+
* exec: 'worker.js',
|
452 |
+
* args: ['--use', 'https'],
|
453 |
+
* silent: true,
|
454 |
+
* });
|
455 |
+
* cluster.fork(); // https worker
|
456 |
+
* cluster.setupPrimary({
|
457 |
+
* exec: 'worker.js',
|
458 |
+
* args: ['--use', 'http'],
|
459 |
+
* });
|
460 |
+
* cluster.fork(); // http worker
|
461 |
+
* ```
|
462 |
+
*
|
463 |
+
* This can only be called from the primary process.
|
464 |
+
* @since v16.0.0
|
465 |
+
*/
|
466 |
+
setupPrimary(settings?: ClusterSettings): void;
|
467 |
+
/**
|
468 |
+
* A reference to the current worker object. Not available in the primary process.
|
469 |
+
*
|
470 |
+
* ```js
|
471 |
+
* import cluster from 'node:cluster';
|
472 |
+
*
|
473 |
+
* if (cluster.isPrimary) {
|
474 |
+
* console.log('I am primary');
|
475 |
+
* cluster.fork();
|
476 |
+
* cluster.fork();
|
477 |
+
* } else if (cluster.isWorker) {
|
478 |
+
* console.log(`I am worker #${cluster.worker.id}`);
|
479 |
+
* }
|
480 |
+
* ```
|
481 |
+
* @since v0.7.0
|
482 |
+
*/
|
483 |
+
readonly worker?: Worker | undefined;
|
484 |
+
/**
|
485 |
+
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
486 |
+
*
|
487 |
+
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
488 |
+
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
489 |
+
*
|
490 |
+
* ```js
|
491 |
+
* import cluster from 'node:cluster';
|
492 |
+
*
|
493 |
+
* for (const worker of Object.values(cluster.workers)) {
|
494 |
+
* worker.send('big announcement to all workers');
|
495 |
+
* }
|
496 |
+
* ```
|
497 |
+
* @since v0.7.0
|
498 |
+
*/
|
499 |
+
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
500 |
+
readonly SCHED_NONE: number;
|
501 |
+
readonly SCHED_RR: number;
|
502 |
+
/**
|
503 |
+
* events.EventEmitter
|
504 |
+
* 1. disconnect
|
505 |
+
* 2. exit
|
506 |
+
* 3. fork
|
507 |
+
* 4. listening
|
508 |
+
* 5. message
|
509 |
+
* 6. online
|
510 |
+
* 7. setup
|
511 |
+
*/
|
512 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
513 |
+
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
514 |
+
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
515 |
+
addListener(event: "fork", listener: (worker: Worker) => void): this;
|
516 |
+
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
517 |
+
addListener(
|
518 |
+
event: "message",
|
519 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
520 |
+
): this; // the handle is a net.Socket or net.Server object, or undefined.
|
521 |
+
addListener(event: "online", listener: (worker: Worker) => void): this;
|
522 |
+
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
523 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
524 |
+
emit(event: "disconnect", worker: Worker): boolean;
|
525 |
+
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
|
526 |
+
emit(event: "fork", worker: Worker): boolean;
|
527 |
+
emit(event: "listening", worker: Worker, address: Address): boolean;
|
528 |
+
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
529 |
+
emit(event: "online", worker: Worker): boolean;
|
530 |
+
emit(event: "setup", settings: ClusterSettings): boolean;
|
531 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
532 |
+
on(event: "disconnect", listener: (worker: Worker) => void): this;
|
533 |
+
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
534 |
+
on(event: "fork", listener: (worker: Worker) => void): this;
|
535 |
+
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
536 |
+
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
537 |
+
on(event: "online", listener: (worker: Worker) => void): this;
|
538 |
+
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
539 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
540 |
+
once(event: "disconnect", listener: (worker: Worker) => void): this;
|
541 |
+
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
542 |
+
once(event: "fork", listener: (worker: Worker) => void): this;
|
543 |
+
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
544 |
+
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
545 |
+
once(event: "online", listener: (worker: Worker) => void): this;
|
546 |
+
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
547 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
548 |
+
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
549 |
+
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
550 |
+
prependListener(event: "fork", listener: (worker: Worker) => void): this;
|
551 |
+
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
552 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
553 |
+
prependListener(
|
554 |
+
event: "message",
|
555 |
+
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
|
556 |
+
): this;
|
557 |
+
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
558 |
+
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
559 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
560 |
+
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
561 |
+
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
562 |
+
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
|
563 |
+
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
564 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
565 |
+
prependOnceListener(
|
566 |
+
event: "message",
|
567 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
568 |
+
): this;
|
569 |
+
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
570 |
+
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
571 |
+
}
|
572 |
+
const cluster: Cluster;
|
573 |
+
export default cluster;
|
574 |
+
}
|
575 |
+
declare module "node:cluster" {
|
576 |
+
export * from "cluster";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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:console` module provides a simple debugging console that is similar to
|
3 |
+
* the JavaScript console mechanism provided by web browsers.
|
4 |
+
*
|
5 |
+
* The module exports two specific components:
|
6 |
+
*
|
7 |
+
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
8 |
+
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and
|
9 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('node:console')`.
|
10 |
+
*
|
11 |
+
* _**Warning**_: The global console object's methods are neither consistently
|
12 |
+
* synchronous like the browser APIs they resemble, nor are they consistently
|
13 |
+
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for
|
14 |
+
* more information.
|
15 |
+
*
|
16 |
+
* Example using the global `console`:
|
17 |
+
*
|
18 |
+
* ```js
|
19 |
+
* console.log('hello world');
|
20 |
+
* // Prints: hello world, to stdout
|
21 |
+
* console.log('hello %s', 'world');
|
22 |
+
* // Prints: hello world, to stdout
|
23 |
+
* console.error(new Error('Whoops, something bad happened'));
|
24 |
+
* // Prints error message and stack trace to stderr:
|
25 |
+
* // Error: Whoops, something bad happened
|
26 |
+
* // at [eval]:5:15
|
27 |
+
* // at Script.runInThisContext (node:vm:132:18)
|
28 |
+
* // at Object.runInThisContext (node:vm:309:38)
|
29 |
+
* // at node:internal/process/execution:77:19
|
30 |
+
* // at [eval]-wrapper:6:22
|
31 |
+
* // at evalScript (node:internal/process/execution:76:60)
|
32 |
+
* // at node:internal/main/eval_string:23:3
|
33 |
+
*
|
34 |
+
* const name = 'Will Robinson';
|
35 |
+
* console.warn(`Danger ${name}! Danger!`);
|
36 |
+
* // Prints: Danger Will Robinson! Danger!, to stderr
|
37 |
+
* ```
|
38 |
+
*
|
39 |
+
* Example using the `Console` class:
|
40 |
+
*
|
41 |
+
* ```js
|
42 |
+
* const out = getStreamSomehow();
|
43 |
+
* const err = getStreamSomehow();
|
44 |
+
* const myConsole = new console.Console(out, err);
|
45 |
+
*
|
46 |
+
* myConsole.log('hello world');
|
47 |
+
* // Prints: hello world, to out
|
48 |
+
* myConsole.log('hello %s', 'world');
|
49 |
+
* // Prints: hello world, to out
|
50 |
+
* myConsole.error(new Error('Whoops, something bad happened'));
|
51 |
+
* // Prints: [Error: Whoops, something bad happened], to err
|
52 |
+
*
|
53 |
+
* const name = 'Will Robinson';
|
54 |
+
* myConsole.warn(`Danger ${name}! Danger!`);
|
55 |
+
* // Prints: Danger Will Robinson! Danger!, to err
|
56 |
+
* ```
|
57 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
|
58 |
+
*/
|
59 |
+
declare module "console" {
|
60 |
+
import console = require("node:console");
|
61 |
+
export = console;
|
62 |
+
}
|
63 |
+
declare module "node:console" {
|
64 |
+
import { InspectOptions } from "node:util";
|
65 |
+
global {
|
66 |
+
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
|
67 |
+
interface Console {
|
68 |
+
Console: console.ConsoleConstructor;
|
69 |
+
/**
|
70 |
+
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
|
71 |
+
* writes a message and does not otherwise affect execution. The output always
|
72 |
+
* starts with `"Assertion failed"`. If provided, `message` is formatted using
|
73 |
+
* [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args).
|
74 |
+
*
|
75 |
+
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
|
76 |
+
*
|
77 |
+
* ```js
|
78 |
+
* console.assert(true, 'does nothing');
|
79 |
+
*
|
80 |
+
* console.assert(false, 'Whoops %s work', 'didn\'t');
|
81 |
+
* // Assertion failed: Whoops didn't work
|
82 |
+
*
|
83 |
+
* console.assert();
|
84 |
+
* // Assertion failed
|
85 |
+
* ```
|
86 |
+
* @since v0.1.101
|
87 |
+
* @param value The value tested for being truthy.
|
88 |
+
* @param message All arguments besides `value` are used as error message.
|
89 |
+
*/
|
90 |
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
91 |
+
/**
|
92 |
+
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
|
93 |
+
* TTY. When `stdout` is not a TTY, this method does nothing.
|
94 |
+
*
|
95 |
+
* The specific operation of `console.clear()` can vary across operating systems
|
96 |
+
* and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
|
97 |
+
* current terminal viewport for the Node.js
|
98 |
+
* binary.
|
99 |
+
* @since v8.3.0
|
100 |
+
*/
|
101 |
+
clear(): void;
|
102 |
+
/**
|
103 |
+
* Maintains an internal counter specific to `label` and outputs to `stdout` the
|
104 |
+
* number of times `console.count()` has been called with the given `label`.
|
105 |
+
*
|
106 |
+
* ```js
|
107 |
+
* > console.count()
|
108 |
+
* default: 1
|
109 |
+
* undefined
|
110 |
+
* > console.count('default')
|
111 |
+
* default: 2
|
112 |
+
* undefined
|
113 |
+
* > console.count('abc')
|
114 |
+
* abc: 1
|
115 |
+
* undefined
|
116 |
+
* > console.count('xyz')
|
117 |
+
* xyz: 1
|
118 |
+
* undefined
|
119 |
+
* > console.count('abc')
|
120 |
+
* abc: 2
|
121 |
+
* undefined
|
122 |
+
* > console.count()
|
123 |
+
* default: 3
|
124 |
+
* undefined
|
125 |
+
* >
|
126 |
+
* ```
|
127 |
+
* @since v8.3.0
|
128 |
+
* @param [label='default'] The display label for the counter.
|
129 |
+
*/
|
130 |
+
count(label?: string): void;
|
131 |
+
/**
|
132 |
+
* Resets the internal counter specific to `label`.
|
133 |
+
*
|
134 |
+
* ```js
|
135 |
+
* > console.count('abc');
|
136 |
+
* abc: 1
|
137 |
+
* undefined
|
138 |
+
* > console.countReset('abc');
|
139 |
+
* undefined
|
140 |
+
* > console.count('abc');
|
141 |
+
* abc: 1
|
142 |
+
* undefined
|
143 |
+
* >
|
144 |
+
* ```
|
145 |
+
* @since v8.3.0
|
146 |
+
* @param [label='default'] The display label for the counter.
|
147 |
+
*/
|
148 |
+
countReset(label?: string): void;
|
149 |
+
/**
|
150 |
+
* The `console.debug()` function is an alias for {@link log}.
|
151 |
+
* @since v8.0.0
|
152 |
+
*/
|
153 |
+
debug(message?: any, ...optionalParams: any[]): void;
|
154 |
+
/**
|
155 |
+
* Uses [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
|
156 |
+
* This function bypasses any custom `inspect()` function defined on `obj`.
|
157 |
+
* @since v0.1.101
|
158 |
+
*/
|
159 |
+
dir(obj: any, options?: InspectOptions): void;
|
160 |
+
/**
|
161 |
+
* This method calls `console.log()` passing it the arguments received.
|
162 |
+
* This method does not produce any XML formatting.
|
163 |
+
* @since v8.0.0
|
164 |
+
*/
|
165 |
+
dirxml(...data: any[]): void;
|
166 |
+
/**
|
167 |
+
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
168 |
+
* first used as the primary message and all additional used as substitution
|
169 |
+
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
170 |
+
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)).
|
171 |
+
*
|
172 |
+
* ```js
|
173 |
+
* const code = 5;
|
174 |
+
* console.error('error #%d', code);
|
175 |
+
* // Prints: error #5, to stderr
|
176 |
+
* console.error('error', code);
|
177 |
+
* // Prints: error 5, to stderr
|
178 |
+
* ```
|
179 |
+
*
|
180 |
+
* If formatting elements (e.g. `%d`) are not found in the first string then
|
181 |
+
* [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options) is called on each argument and the
|
182 |
+
* resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)
|
183 |
+
* for more information.
|
184 |
+
* @since v0.1.100
|
185 |
+
*/
|
186 |
+
error(message?: any, ...optionalParams: any[]): void;
|
187 |
+
/**
|
188 |
+
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
|
189 |
+
*
|
190 |
+
* If one or more `label`s are provided, those are printed first without the
|
191 |
+
* additional indentation.
|
192 |
+
* @since v8.5.0
|
193 |
+
*/
|
194 |
+
group(...label: any[]): void;
|
195 |
+
/**
|
196 |
+
* An alias for {@link group}.
|
197 |
+
* @since v8.5.0
|
198 |
+
*/
|
199 |
+
groupCollapsed(...label: any[]): void;
|
200 |
+
/**
|
201 |
+
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
|
202 |
+
* @since v8.5.0
|
203 |
+
*/
|
204 |
+
groupEnd(): void;
|
205 |
+
/**
|
206 |
+
* The `console.info()` function is an alias for {@link log}.
|
207 |
+
* @since v0.1.100
|
208 |
+
*/
|
209 |
+
info(message?: any, ...optionalParams: any[]): void;
|
210 |
+
/**
|
211 |
+
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
212 |
+
* first used as the primary message and all additional used as substitution
|
213 |
+
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
214 |
+
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)).
|
215 |
+
*
|
216 |
+
* ```js
|
217 |
+
* const count = 5;
|
218 |
+
* console.log('count: %d', count);
|
219 |
+
* // Prints: count: 5, to stdout
|
220 |
+
* console.log('count:', count);
|
221 |
+
* // Prints: count: 5, to stdout
|
222 |
+
* ```
|
223 |
+
*
|
224 |
+
* See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.
|
225 |
+
* @since v0.1.100
|
226 |
+
*/
|
227 |
+
log(message?: any, ...optionalParams: any[]): void;
|
228 |
+
/**
|
229 |
+
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
|
230 |
+
* logging the argument if it can't be parsed as tabular.
|
231 |
+
*
|
232 |
+
* ```js
|
233 |
+
* // These can't be parsed as tabular data
|
234 |
+
* console.table(Symbol());
|
235 |
+
* // Symbol()
|
236 |
+
*
|
237 |
+
* console.table(undefined);
|
238 |
+
* // undefined
|
239 |
+
*
|
240 |
+
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
|
241 |
+
* // ┌─────────┬─────┬─────┐
|
242 |
+
* // │ (index) │ a │ b │
|
243 |
+
* // ├─────────┼─────┼─────┤
|
244 |
+
* // │ 0 │ 1 │ 'Y' │
|
245 |
+
* // │ 1 │ 'Z' │ 2 │
|
246 |
+
* // └─────────┴─────┴─────┘
|
247 |
+
*
|
248 |
+
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
|
249 |
+
* // ┌─────────┬─────┐
|
250 |
+
* // │ (index) │ a │
|
251 |
+
* // ├─────────┼─────┤
|
252 |
+
* // │ 0 │ 1 │
|
253 |
+
* // │ 1 │ 'Z' │
|
254 |
+
* // └─────────┴─────┘
|
255 |
+
* ```
|
256 |
+
* @since v10.0.0
|
257 |
+
* @param properties Alternate properties for constructing the table.
|
258 |
+
*/
|
259 |
+
table(tabularData: any, properties?: readonly string[]): void;
|
260 |
+
/**
|
261 |
+
* Starts a timer that can be used to compute the duration of an operation. Timers
|
262 |
+
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
|
263 |
+
* suitable time units to `stdout`. For example, if the elapsed
|
264 |
+
* time is 3869ms, `console.timeEnd()` displays "3.869s".
|
265 |
+
* @since v0.1.104
|
266 |
+
* @param [label='default']
|
267 |
+
*/
|
268 |
+
time(label?: string): void;
|
269 |
+
/**
|
270 |
+
* Stops a timer that was previously started by calling {@link time} and
|
271 |
+
* prints the result to `stdout`:
|
272 |
+
*
|
273 |
+
* ```js
|
274 |
+
* console.time('bunch-of-stuff');
|
275 |
+
* // Do a bunch of stuff.
|
276 |
+
* console.timeEnd('bunch-of-stuff');
|
277 |
+
* // Prints: bunch-of-stuff: 225.438ms
|
278 |
+
* ```
|
279 |
+
* @since v0.1.104
|
280 |
+
* @param [label='default']
|
281 |
+
*/
|
282 |
+
timeEnd(label?: string): void;
|
283 |
+
/**
|
284 |
+
* For a timer that was previously started by calling {@link time}, prints
|
285 |
+
* the elapsed time and other `data` arguments to `stdout`:
|
286 |
+
*
|
287 |
+
* ```js
|
288 |
+
* console.time('process');
|
289 |
+
* const value = expensiveProcess1(); // Returns 42
|
290 |
+
* console.timeLog('process', value);
|
291 |
+
* // Prints "process: 365.227ms 42".
|
292 |
+
* doExpensiveProcess2(value);
|
293 |
+
* console.timeEnd('process');
|
294 |
+
* ```
|
295 |
+
* @since v10.7.0
|
296 |
+
* @param [label='default']
|
297 |
+
*/
|
298 |
+
timeLog(label?: string, ...data: any[]): void;
|
299 |
+
/**
|
300 |
+
* Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)
|
301 |
+
* formatted message and stack trace to the current position in the code.
|
302 |
+
*
|
303 |
+
* ```js
|
304 |
+
* console.trace('Show me');
|
305 |
+
* // Prints: (stack trace will vary based on where trace is called)
|
306 |
+
* // Trace: Show me
|
307 |
+
* // at repl:2:9
|
308 |
+
* // at REPLServer.defaultEval (repl.js:248:27)
|
309 |
+
* // at bound (domain.js:287:14)
|
310 |
+
* // at REPLServer.runBound [as eval] (domain.js:300:12)
|
311 |
+
* // at REPLServer.<anonymous> (repl.js:412:12)
|
312 |
+
* // at emitOne (events.js:82:20)
|
313 |
+
* // at REPLServer.emit (events.js:169:7)
|
314 |
+
* // at REPLServer.Interface._onLine (readline.js:210:10)
|
315 |
+
* // at REPLServer.Interface._line (readline.js:549:8)
|
316 |
+
* // at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
317 |
+
* ```
|
318 |
+
* @since v0.1.104
|
319 |
+
*/
|
320 |
+
trace(message?: any, ...optionalParams: any[]): void;
|
321 |
+
/**
|
322 |
+
* The `console.warn()` function is an alias for {@link error}.
|
323 |
+
* @since v0.1.100
|
324 |
+
*/
|
325 |
+
warn(message?: any, ...optionalParams: any[]): void;
|
326 |
+
// --- Inspector mode only ---
|
327 |
+
/**
|
328 |
+
* This method does not display anything unless used in the inspector. The `console.profile()`
|
329 |
+
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
|
330 |
+
* is called. The profile is then added to the Profile panel of the inspector.
|
331 |
+
*
|
332 |
+
* ```js
|
333 |
+
* console.profile('MyLabel');
|
334 |
+
* // Some code
|
335 |
+
* console.profileEnd('MyLabel');
|
336 |
+
* // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
|
337 |
+
* ```
|
338 |
+
* @since v8.0.0
|
339 |
+
*/
|
340 |
+
profile(label?: string): void;
|
341 |
+
/**
|
342 |
+
* This method does not display anything unless used in the inspector. Stops the current
|
343 |
+
* JavaScript CPU profiling session if one has been started and prints the report to the
|
344 |
+
* Profiles panel of the inspector. See {@link profile} for an example.
|
345 |
+
*
|
346 |
+
* If this method is called without a label, the most recently started profile is stopped.
|
347 |
+
* @since v8.0.0
|
348 |
+
*/
|
349 |
+
profileEnd(label?: string): void;
|
350 |
+
/**
|
351 |
+
* This method does not display anything unless used in the inspector. The `console.timeStamp()`
|
352 |
+
* method adds an event with the label `'label'` to the Timeline panel of the inspector.
|
353 |
+
* @since v8.0.0
|
354 |
+
*/
|
355 |
+
timeStamp(label?: string): void;
|
356 |
+
}
|
357 |
+
/**
|
358 |
+
* The `console` module provides a simple debugging console that is similar to the
|
359 |
+
* JavaScript console mechanism provided by web browsers.
|
360 |
+
*
|
361 |
+
* The module exports two specific components:
|
362 |
+
*
|
363 |
+
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
|
364 |
+
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and
|
365 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.
|
366 |
+
*
|
367 |
+
* _**Warning**_: The global console object's methods are neither consistently
|
368 |
+
* synchronous like the browser APIs they resemble, nor are they consistently
|
369 |
+
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for
|
370 |
+
* more information.
|
371 |
+
*
|
372 |
+
* Example using the global `console`:
|
373 |
+
*
|
374 |
+
* ```js
|
375 |
+
* console.log('hello world');
|
376 |
+
* // Prints: hello world, to stdout
|
377 |
+
* console.log('hello %s', 'world');
|
378 |
+
* // Prints: hello world, to stdout
|
379 |
+
* console.error(new Error('Whoops, something bad happened'));
|
380 |
+
* // Prints error message and stack trace to stderr:
|
381 |
+
* // Error: Whoops, something bad happened
|
382 |
+
* // at [eval]:5:15
|
383 |
+
* // at Script.runInThisContext (node:vm:132:18)
|
384 |
+
* // at Object.runInThisContext (node:vm:309:38)
|
385 |
+
* // at node:internal/process/execution:77:19
|
386 |
+
* // at [eval]-wrapper:6:22
|
387 |
+
* // at evalScript (node:internal/process/execution:76:60)
|
388 |
+
* // at node:internal/main/eval_string:23:3
|
389 |
+
*
|
390 |
+
* const name = 'Will Robinson';
|
391 |
+
* console.warn(`Danger ${name}! Danger!`);
|
392 |
+
* // Prints: Danger Will Robinson! Danger!, to stderr
|
393 |
+
* ```
|
394 |
+
*
|
395 |
+
* Example using the `Console` class:
|
396 |
+
*
|
397 |
+
* ```js
|
398 |
+
* const out = getStreamSomehow();
|
399 |
+
* const err = getStreamSomehow();
|
400 |
+
* const myConsole = new console.Console(out, err);
|
401 |
+
*
|
402 |
+
* myConsole.log('hello world');
|
403 |
+
* // Prints: hello world, to out
|
404 |
+
* myConsole.log('hello %s', 'world');
|
405 |
+
* // Prints: hello world, to out
|
406 |
+
* myConsole.error(new Error('Whoops, something bad happened'));
|
407 |
+
* // Prints: [Error: Whoops, something bad happened], to err
|
408 |
+
*
|
409 |
+
* const name = 'Will Robinson';
|
410 |
+
* myConsole.warn(`Danger ${name}! Danger!`);
|
411 |
+
* // Prints: Danger Will Robinson! Danger!, to err
|
412 |
+
* ```
|
413 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/console.js)
|
414 |
+
*/
|
415 |
+
namespace console {
|
416 |
+
interface ConsoleConstructorOptions {
|
417 |
+
stdout: NodeJS.WritableStream;
|
418 |
+
stderr?: NodeJS.WritableStream | undefined;
|
419 |
+
/**
|
420 |
+
* Ignore errors when writing to the underlying streams.
|
421 |
+
* @default true
|
422 |
+
*/
|
423 |
+
ignoreErrors?: boolean | undefined;
|
424 |
+
/**
|
425 |
+
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
|
426 |
+
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
|
427 |
+
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
|
428 |
+
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
|
429 |
+
* @default auto
|
430 |
+
*/
|
431 |
+
colorMode?: boolean | "auto" | undefined;
|
432 |
+
/**
|
433 |
+
* Specifies options that are passed along to
|
434 |
+
* [`util.inspect()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilinspectobject-options).
|
435 |
+
*/
|
436 |
+
inspectOptions?: InspectOptions | undefined;
|
437 |
+
/**
|
438 |
+
* Set group indentation.
|
439 |
+
* @default 2
|
440 |
+
*/
|
441 |
+
groupIndentation?: number | undefined;
|
442 |
+
}
|
443 |
+
interface ConsoleConstructor {
|
444 |
+
prototype: Console;
|
445 |
+
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
446 |
+
new(options: ConsoleConstructorOptions): Console;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
var console: Console;
|
450 |
+
}
|
451 |
+
export = globalThis.console;
|
452 |
+
}
|
workers1/auto3d/node_modules/@types/node/constants.d.ts
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
|
2 |
+
declare module "constants" {
|
3 |
+
import { constants as osConstants, SignalConstants } from "node:os";
|
4 |
+
import { constants as cryptoConstants } from "node:crypto";
|
5 |
+
import { constants as fsConstants } from "node:fs";
|
6 |
+
|
7 |
+
const exp:
|
8 |
+
& typeof osConstants.errno
|
9 |
+
& typeof osConstants.priority
|
10 |
+
& SignalConstants
|
11 |
+
& typeof cryptoConstants
|
12 |
+
& typeof fsConstants;
|
13 |
+
export = exp;
|
14 |
+
}
|
15 |
+
|
16 |
+
declare module "node:constants" {
|
17 |
+
import constants = require("constants");
|
18 |
+
export = constants;
|
19 |
+
}
|
workers1/auto3d/node_modules/@types/node/crypto.d.ts
ADDED
The diff for this file is too large to render.
See raw diff
|
|
workers1/auto3d/node_modules/@types/node/dgram.d.ts
ADDED
@@ -0,0 +1,596 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:dgram` module provides an implementation of UDP datagram sockets.
|
3 |
+
*
|
4 |
+
* ```js
|
5 |
+
* import dgram from 'node:dgram';
|
6 |
+
*
|
7 |
+
* const server = dgram.createSocket('udp4');
|
8 |
+
*
|
9 |
+
* server.on('error', (err) => {
|
10 |
+
* console.error(`server error:\n${err.stack}`);
|
11 |
+
* server.close();
|
12 |
+
* });
|
13 |
+
*
|
14 |
+
* server.on('message', (msg, rinfo) => {
|
15 |
+
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
16 |
+
* });
|
17 |
+
*
|
18 |
+
* server.on('listening', () => {
|
19 |
+
* const address = server.address();
|
20 |
+
* console.log(`server listening ${address.address}:${address.port}`);
|
21 |
+
* });
|
22 |
+
*
|
23 |
+
* server.bind(41234);
|
24 |
+
* // Prints: server listening 0.0.0.0:41234
|
25 |
+
* ```
|
26 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dgram.js)
|
27 |
+
*/
|
28 |
+
declare module "dgram" {
|
29 |
+
import { AddressInfo } from "node:net";
|
30 |
+
import * as dns from "node:dns";
|
31 |
+
import { Abortable, EventEmitter } from "node:events";
|
32 |
+
interface RemoteInfo {
|
33 |
+
address: string;
|
34 |
+
family: "IPv4" | "IPv6";
|
35 |
+
port: number;
|
36 |
+
size: number;
|
37 |
+
}
|
38 |
+
interface BindOptions {
|
39 |
+
port?: number | undefined;
|
40 |
+
address?: string | undefined;
|
41 |
+
exclusive?: boolean | undefined;
|
42 |
+
fd?: number | undefined;
|
43 |
+
}
|
44 |
+
type SocketType = "udp4" | "udp6";
|
45 |
+
interface SocketOptions extends Abortable {
|
46 |
+
type: SocketType;
|
47 |
+
reuseAddr?: boolean | undefined;
|
48 |
+
/**
|
49 |
+
* @default false
|
50 |
+
*/
|
51 |
+
ipv6Only?: boolean | undefined;
|
52 |
+
recvBufferSize?: number | undefined;
|
53 |
+
sendBufferSize?: number | undefined;
|
54 |
+
lookup?:
|
55 |
+
| ((
|
56 |
+
hostname: string,
|
57 |
+
options: dns.LookupOneOptions,
|
58 |
+
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
59 |
+
) => void)
|
60 |
+
| undefined;
|
61 |
+
}
|
62 |
+
/**
|
63 |
+
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
|
64 |
+
* messages. When `address` and `port` are not passed to `socket.bind()` the
|
65 |
+
* method will bind the socket to the "all interfaces" address on a random port
|
66 |
+
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
|
67 |
+
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
|
68 |
+
*
|
69 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
|
70 |
+
*
|
71 |
+
* ```js
|
72 |
+
* const controller = new AbortController();
|
73 |
+
* const { signal } = controller;
|
74 |
+
* const server = dgram.createSocket({ type: 'udp4', signal });
|
75 |
+
* server.on('message', (msg, rinfo) => {
|
76 |
+
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
77 |
+
* });
|
78 |
+
* // Later, when you want to close the server.
|
79 |
+
* controller.abort();
|
80 |
+
* ```
|
81 |
+
* @since v0.11.13
|
82 |
+
* @param options Available options are:
|
83 |
+
* @param callback Attached as a listener for `'message'` events. Optional.
|
84 |
+
*/
|
85 |
+
function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
86 |
+
function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
87 |
+
/**
|
88 |
+
* Encapsulates the datagram functionality.
|
89 |
+
*
|
90 |
+
* New instances of `dgram.Socket` are created using {@link createSocket}.
|
91 |
+
* The `new` keyword is not to be used to create `dgram.Socket` instances.
|
92 |
+
* @since v0.1.99
|
93 |
+
*/
|
94 |
+
class Socket extends EventEmitter {
|
95 |
+
/**
|
96 |
+
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
|
97 |
+
* specified, the operating system will choose
|
98 |
+
* one interface and will add membership to it. To add membership to every
|
99 |
+
* available interface, call `addMembership` multiple times, once per interface.
|
100 |
+
*
|
101 |
+
* When called on an unbound socket, this method will implicitly bind to a random
|
102 |
+
* port, listening on all interfaces.
|
103 |
+
*
|
104 |
+
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
|
105 |
+
*
|
106 |
+
* ```js
|
107 |
+
* import cluster from 'node:cluster';
|
108 |
+
* import dgram from 'node:dgram';
|
109 |
+
*
|
110 |
+
* if (cluster.isPrimary) {
|
111 |
+
* cluster.fork(); // Works ok.
|
112 |
+
* cluster.fork(); // Fails with EADDRINUSE.
|
113 |
+
* } else {
|
114 |
+
* const s = dgram.createSocket('udp4');
|
115 |
+
* s.bind(1234, () => {
|
116 |
+
* s.addMembership('224.0.0.114');
|
117 |
+
* });
|
118 |
+
* }
|
119 |
+
* ```
|
120 |
+
* @since v0.6.9
|
121 |
+
*/
|
122 |
+
addMembership(multicastAddress: string, multicastInterface?: string): void;
|
123 |
+
/**
|
124 |
+
* Returns an object containing the address information for a socket.
|
125 |
+
* For UDP sockets, this object will contain `address`, `family`, and `port` properties.
|
126 |
+
*
|
127 |
+
* This method throws `EBADF` if called on an unbound socket.
|
128 |
+
* @since v0.1.99
|
129 |
+
*/
|
130 |
+
address(): AddressInfo;
|
131 |
+
/**
|
132 |
+
* For UDP sockets, causes the `dgram.Socket` to listen for datagram
|
133 |
+
* messages on a named `port` and optional `address`. If `port` is not
|
134 |
+
* specified or is `0`, the operating system will attempt to bind to a
|
135 |
+
* random port. If `address` is not specified, the operating system will
|
136 |
+
* attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
|
137 |
+
* called.
|
138 |
+
*
|
139 |
+
* Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
|
140 |
+
* useful.
|
141 |
+
*
|
142 |
+
* A bound datagram socket keeps the Node.js process running to receive
|
143 |
+
* datagram messages.
|
144 |
+
*
|
145 |
+
* If binding fails, an `'error'` event is generated. In rare case (e.g.
|
146 |
+
* attempting to bind with a closed socket), an `Error` may be thrown.
|
147 |
+
*
|
148 |
+
* Example of a UDP server listening on port 41234:
|
149 |
+
*
|
150 |
+
* ```js
|
151 |
+
* import dgram from 'node:dgram';
|
152 |
+
*
|
153 |
+
* const server = dgram.createSocket('udp4');
|
154 |
+
*
|
155 |
+
* server.on('error', (err) => {
|
156 |
+
* console.error(`server error:\n${err.stack}`);
|
157 |
+
* server.close();
|
158 |
+
* });
|
159 |
+
*
|
160 |
+
* server.on('message', (msg, rinfo) => {
|
161 |
+
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
162 |
+
* });
|
163 |
+
*
|
164 |
+
* server.on('listening', () => {
|
165 |
+
* const address = server.address();
|
166 |
+
* console.log(`server listening ${address.address}:${address.port}`);
|
167 |
+
* });
|
168 |
+
*
|
169 |
+
* server.bind(41234);
|
170 |
+
* // Prints: server listening 0.0.0.0:41234
|
171 |
+
* ```
|
172 |
+
* @since v0.1.99
|
173 |
+
* @param callback with no parameters. Called when binding is complete.
|
174 |
+
*/
|
175 |
+
bind(port?: number, address?: string, callback?: () => void): this;
|
176 |
+
bind(port?: number, callback?: () => void): this;
|
177 |
+
bind(callback?: () => void): this;
|
178 |
+
bind(options: BindOptions, callback?: () => void): this;
|
179 |
+
/**
|
180 |
+
* Close the underlying socket and stop listening for data on it. If a callback is
|
181 |
+
* provided, it is added as a listener for the `'close'` event.
|
182 |
+
* @since v0.1.99
|
183 |
+
* @param callback Called when the socket has been closed.
|
184 |
+
*/
|
185 |
+
close(callback?: () => void): this;
|
186 |
+
/**
|
187 |
+
* Associates the `dgram.Socket` to a remote address and port. Every
|
188 |
+
* message sent by this handle is automatically sent to that destination. Also,
|
189 |
+
* the socket will only receive messages from that remote peer.
|
190 |
+
* Trying to call `connect()` on an already connected socket will result
|
191 |
+
* in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
|
192 |
+
* provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
|
193 |
+
* will be used by default. Once the connection is complete, a `'connect'` event
|
194 |
+
* is emitted and the optional `callback` function is called. In case of failure,
|
195 |
+
* the `callback` is called or, failing this, an `'error'` event is emitted.
|
196 |
+
* @since v12.0.0
|
197 |
+
* @param callback Called when the connection is completed or on error.
|
198 |
+
*/
|
199 |
+
connect(port: number, address?: string, callback?: () => void): void;
|
200 |
+
connect(port: number, callback: () => void): void;
|
201 |
+
/**
|
202 |
+
* A synchronous function that disassociates a connected `dgram.Socket` from
|
203 |
+
* its remote address. Trying to call `disconnect()` on an unbound or already
|
204 |
+
* disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
|
205 |
+
* @since v12.0.0
|
206 |
+
*/
|
207 |
+
disconnect(): void;
|
208 |
+
/**
|
209 |
+
* Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
210 |
+
* kernel when the socket is closed or the process terminates, so most apps will
|
211 |
+
* never have reason to call this.
|
212 |
+
*
|
213 |
+
* If `multicastInterface` is not specified, the operating system will attempt to
|
214 |
+
* drop membership on all valid interfaces.
|
215 |
+
* @since v0.6.9
|
216 |
+
*/
|
217 |
+
dropMembership(multicastAddress: string, multicastInterface?: string): void;
|
218 |
+
/**
|
219 |
+
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
220 |
+
* @since v8.7.0
|
221 |
+
* @return the `SO_RCVBUF` socket receive buffer size in bytes.
|
222 |
+
*/
|
223 |
+
getRecvBufferSize(): number;
|
224 |
+
/**
|
225 |
+
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
226 |
+
* @since v8.7.0
|
227 |
+
* @return the `SO_SNDBUF` socket send buffer size in bytes.
|
228 |
+
*/
|
229 |
+
getSendBufferSize(): number;
|
230 |
+
/**
|
231 |
+
* @since v18.8.0, v16.19.0
|
232 |
+
* @return Number of bytes queued for sending.
|
233 |
+
*/
|
234 |
+
getSendQueueSize(): number;
|
235 |
+
/**
|
236 |
+
* @since v18.8.0, v16.19.0
|
237 |
+
* @return Number of send requests currently in the queue awaiting to be processed.
|
238 |
+
*/
|
239 |
+
getSendQueueCount(): number;
|
240 |
+
/**
|
241 |
+
* By default, binding a socket will cause it to block the Node.js process from
|
242 |
+
* exiting as long as the socket is open. The `socket.unref()` method can be used
|
243 |
+
* to exclude the socket from the reference counting that keeps the Node.js
|
244 |
+
* process active. The `socket.ref()` method adds the socket back to the reference
|
245 |
+
* counting and restores the default behavior.
|
246 |
+
*
|
247 |
+
* Calling `socket.ref()` multiples times will have no additional effect.
|
248 |
+
*
|
249 |
+
* The `socket.ref()` method returns a reference to the socket so calls can be
|
250 |
+
* chained.
|
251 |
+
* @since v0.9.1
|
252 |
+
*/
|
253 |
+
ref(): this;
|
254 |
+
/**
|
255 |
+
* Returns an object containing the `address`, `family`, and `port` of the remote
|
256 |
+
* endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
|
257 |
+
* if the socket is not connected.
|
258 |
+
* @since v12.0.0
|
259 |
+
*/
|
260 |
+
remoteAddress(): AddressInfo;
|
261 |
+
/**
|
262 |
+
* Broadcasts a datagram on the socket.
|
263 |
+
* For connectionless sockets, the destination `port` and `address` must be
|
264 |
+
* specified. Connected sockets, on the other hand, will use their associated
|
265 |
+
* remote endpoint, so the `port` and `address` arguments must not be set.
|
266 |
+
*
|
267 |
+
* The `msg` argument contains the message to be sent.
|
268 |
+
* Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
|
269 |
+
* any `TypedArray` or a `DataView`,
|
270 |
+
* the `offset` and `length` specify the offset within the `Buffer` where the
|
271 |
+
* message begins and the number of bytes in the message, respectively.
|
272 |
+
* If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
|
273 |
+
* contain multi-byte characters, `offset` and `length` will be calculated with
|
274 |
+
* respect to `byte length` and not the character position.
|
275 |
+
* If `msg` is an array, `offset` and `length` must not be specified.
|
276 |
+
*
|
277 |
+
* The `address` argument is a string. If the value of `address` is a host name,
|
278 |
+
* DNS will be used to resolve the address of the host. If `address` is not
|
279 |
+
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) will be used by default.
|
280 |
+
*
|
281 |
+
* If the socket has not been previously bound with a call to `bind`, the socket
|
282 |
+
* is assigned a random port number and is bound to the "all interfaces" address
|
283 |
+
* (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
|
284 |
+
*
|
285 |
+
* An optional `callback` function may be specified to as a way of reporting
|
286 |
+
* DNS errors or for determining when it is safe to reuse the `buf` object.
|
287 |
+
* DNS lookups delay the time to send for at least one tick of the
|
288 |
+
* Node.js event loop.
|
289 |
+
*
|
290 |
+
* The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
|
291 |
+
* passed as the first argument to the `callback`. If a `callback` is not given,
|
292 |
+
* the error is emitted as an `'error'` event on the `socket` object.
|
293 |
+
*
|
294 |
+
* Offset and length are optional but both _must_ be set if either are used.
|
295 |
+
* They are supported only when the first argument is a `Buffer`, a `TypedArray`,
|
296 |
+
* or a `DataView`.
|
297 |
+
*
|
298 |
+
* This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
|
299 |
+
*
|
300 |
+
* Example of sending a UDP packet to a port on `localhost`;
|
301 |
+
*
|
302 |
+
* ```js
|
303 |
+
* import dgram from 'node:dgram';
|
304 |
+
* import { Buffer } from 'node:buffer';
|
305 |
+
*
|
306 |
+
* const message = Buffer.from('Some bytes');
|
307 |
+
* const client = dgram.createSocket('udp4');
|
308 |
+
* client.send(message, 41234, 'localhost', (err) => {
|
309 |
+
* client.close();
|
310 |
+
* });
|
311 |
+
* ```
|
312 |
+
*
|
313 |
+
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
|
314 |
+
*
|
315 |
+
* ```js
|
316 |
+
* import dgram from 'node:dgram';
|
317 |
+
* import { Buffer } from 'node:buffer';
|
318 |
+
*
|
319 |
+
* const buf1 = Buffer.from('Some ');
|
320 |
+
* const buf2 = Buffer.from('bytes');
|
321 |
+
* const client = dgram.createSocket('udp4');
|
322 |
+
* client.send([buf1, buf2], 41234, (err) => {
|
323 |
+
* client.close();
|
324 |
+
* });
|
325 |
+
* ```
|
326 |
+
*
|
327 |
+
* Sending multiple buffers might be faster or slower depending on the
|
328 |
+
* application and operating system. Run benchmarks to
|
329 |
+
* determine the optimal strategy on a case-by-case basis. Generally speaking,
|
330 |
+
* however, sending multiple buffers is faster.
|
331 |
+
*
|
332 |
+
* Example of sending a UDP packet using a socket connected to a port on `localhost`:
|
333 |
+
*
|
334 |
+
* ```js
|
335 |
+
* import dgram from 'node:dgram';
|
336 |
+
* import { Buffer } from 'node:buffer';
|
337 |
+
*
|
338 |
+
* const message = Buffer.from('Some bytes');
|
339 |
+
* const client = dgram.createSocket('udp4');
|
340 |
+
* client.connect(41234, 'localhost', (err) => {
|
341 |
+
* client.send(message, (err) => {
|
342 |
+
* client.close();
|
343 |
+
* });
|
344 |
+
* });
|
345 |
+
* ```
|
346 |
+
* @since v0.1.99
|
347 |
+
* @param msg Message to be sent.
|
348 |
+
* @param offset Offset in the buffer where the message starts.
|
349 |
+
* @param length Number of bytes in the message.
|
350 |
+
* @param port Destination port.
|
351 |
+
* @param address Destination host name or IP address.
|
352 |
+
* @param callback Called when the message has been sent.
|
353 |
+
*/
|
354 |
+
send(
|
355 |
+
msg: string | Uint8Array | readonly any[],
|
356 |
+
port?: number,
|
357 |
+
address?: string,
|
358 |
+
callback?: (error: Error | null, bytes: number) => void,
|
359 |
+
): void;
|
360 |
+
send(
|
361 |
+
msg: string | Uint8Array | readonly any[],
|
362 |
+
port?: number,
|
363 |
+
callback?: (error: Error | null, bytes: number) => void,
|
364 |
+
): void;
|
365 |
+
send(
|
366 |
+
msg: string | Uint8Array | readonly any[],
|
367 |
+
callback?: (error: Error | null, bytes: number) => void,
|
368 |
+
): void;
|
369 |
+
send(
|
370 |
+
msg: string | Uint8Array,
|
371 |
+
offset: number,
|
372 |
+
length: number,
|
373 |
+
port?: number,
|
374 |
+
address?: string,
|
375 |
+
callback?: (error: Error | null, bytes: number) => void,
|
376 |
+
): void;
|
377 |
+
send(
|
378 |
+
msg: string | Uint8Array,
|
379 |
+
offset: number,
|
380 |
+
length: number,
|
381 |
+
port?: number,
|
382 |
+
callback?: (error: Error | null, bytes: number) => void,
|
383 |
+
): void;
|
384 |
+
send(
|
385 |
+
msg: string | Uint8Array,
|
386 |
+
offset: number,
|
387 |
+
length: number,
|
388 |
+
callback?: (error: Error | null, bytes: number) => void,
|
389 |
+
): void;
|
390 |
+
/**
|
391 |
+
* Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
|
392 |
+
* packets may be sent to a local interface's broadcast address.
|
393 |
+
*
|
394 |
+
* This method throws `EBADF` if called on an unbound socket.
|
395 |
+
* @since v0.6.9
|
396 |
+
*/
|
397 |
+
setBroadcast(flag: boolean): void;
|
398 |
+
/**
|
399 |
+
* _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
|
400 |
+
* 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
|
401 |
+
* _with a scope index is written as `'IP%scope'` where scope is an interface name_
|
402 |
+
* _or interface number._
|
403 |
+
*
|
404 |
+
* Sets the default outgoing multicast interface of the socket to a chosen
|
405 |
+
* interface or back to system interface selection. The `multicastInterface` must
|
406 |
+
* be a valid string representation of an IP from the socket's family.
|
407 |
+
*
|
408 |
+
* For IPv4 sockets, this should be the IP configured for the desired physical
|
409 |
+
* interface. All packets sent to multicast on the socket will be sent on the
|
410 |
+
* interface determined by the most recent successful use of this call.
|
411 |
+
*
|
412 |
+
* For IPv6 sockets, `multicastInterface` should include a scope to indicate the
|
413 |
+
* interface as in the examples that follow. In IPv6, individual `send` calls can
|
414 |
+
* also use explicit scope in addresses, so only packets sent to a multicast
|
415 |
+
* address without specifying an explicit scope are affected by the most recent
|
416 |
+
* successful use of this call.
|
417 |
+
*
|
418 |
+
* This method throws `EBADF` if called on an unbound socket.
|
419 |
+
*
|
420 |
+
* #### Example: IPv6 outgoing multicast interface
|
421 |
+
*
|
422 |
+
* On most systems, where scope format uses the interface name:
|
423 |
+
*
|
424 |
+
* ```js
|
425 |
+
* const socket = dgram.createSocket('udp6');
|
426 |
+
*
|
427 |
+
* socket.bind(1234, () => {
|
428 |
+
* socket.setMulticastInterface('::%eth1');
|
429 |
+
* });
|
430 |
+
* ```
|
431 |
+
*
|
432 |
+
* On Windows, where scope format uses an interface number:
|
433 |
+
*
|
434 |
+
* ```js
|
435 |
+
* const socket = dgram.createSocket('udp6');
|
436 |
+
*
|
437 |
+
* socket.bind(1234, () => {
|
438 |
+
* socket.setMulticastInterface('::%2');
|
439 |
+
* });
|
440 |
+
* ```
|
441 |
+
*
|
442 |
+
* #### Example: IPv4 outgoing multicast interface
|
443 |
+
*
|
444 |
+
* All systems use an IP of the host on the desired physical interface:
|
445 |
+
*
|
446 |
+
* ```js
|
447 |
+
* const socket = dgram.createSocket('udp4');
|
448 |
+
*
|
449 |
+
* socket.bind(1234, () => {
|
450 |
+
* socket.setMulticastInterface('10.0.0.2');
|
451 |
+
* });
|
452 |
+
* ```
|
453 |
+
* @since v8.6.0
|
454 |
+
*/
|
455 |
+
setMulticastInterface(multicastInterface: string): void;
|
456 |
+
/**
|
457 |
+
* Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
|
458 |
+
* multicast packets will also be received on the local interface.
|
459 |
+
*
|
460 |
+
* This method throws `EBADF` if called on an unbound socket.
|
461 |
+
* @since v0.3.8
|
462 |
+
*/
|
463 |
+
setMulticastLoopback(flag: boolean): boolean;
|
464 |
+
/**
|
465 |
+
* Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
|
466 |
+
* "Time to Live", in this context it specifies the number of IP hops that a
|
467 |
+
* packet is allowed to travel through, specifically for multicast traffic. Each
|
468 |
+
* router or gateway that forwards a packet decrements the TTL. If the TTL is
|
469 |
+
* decremented to 0 by a router, it will not be forwarded.
|
470 |
+
*
|
471 |
+
* The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
|
472 |
+
*
|
473 |
+
* This method throws `EBADF` if called on an unbound socket.
|
474 |
+
* @since v0.3.8
|
475 |
+
*/
|
476 |
+
setMulticastTTL(ttl: number): number;
|
477 |
+
/**
|
478 |
+
* Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
|
479 |
+
* in bytes.
|
480 |
+
*
|
481 |
+
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
482 |
+
* @since v8.7.0
|
483 |
+
*/
|
484 |
+
setRecvBufferSize(size: number): void;
|
485 |
+
/**
|
486 |
+
* Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
|
487 |
+
* in bytes.
|
488 |
+
*
|
489 |
+
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
490 |
+
* @since v8.7.0
|
491 |
+
*/
|
492 |
+
setSendBufferSize(size: number): void;
|
493 |
+
/**
|
494 |
+
* Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
|
495 |
+
* in this context it specifies the number of IP hops that a packet is allowed to
|
496 |
+
* travel through. Each router or gateway that forwards a packet decrements the
|
497 |
+
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
|
498 |
+
* Changing TTL values is typically done for network probes or when multicasting.
|
499 |
+
*
|
500 |
+
* The `ttl` argument may be between 1 and 255\. The default on most systems
|
501 |
+
* is 64.
|
502 |
+
*
|
503 |
+
* This method throws `EBADF` if called on an unbound socket.
|
504 |
+
* @since v0.1.101
|
505 |
+
*/
|
506 |
+
setTTL(ttl: number): number;
|
507 |
+
/**
|
508 |
+
* By default, binding a socket will cause it to block the Node.js process from
|
509 |
+
* exiting as long as the socket is open. The `socket.unref()` method can be used
|
510 |
+
* to exclude the socket from the reference counting that keeps the Node.js
|
511 |
+
* process active, allowing the process to exit even if the socket is still
|
512 |
+
* listening.
|
513 |
+
*
|
514 |
+
* Calling `socket.unref()` multiple times will have no additional effect.
|
515 |
+
*
|
516 |
+
* The `socket.unref()` method returns a reference to the socket so calls can be
|
517 |
+
* chained.
|
518 |
+
* @since v0.9.1
|
519 |
+
*/
|
520 |
+
unref(): this;
|
521 |
+
/**
|
522 |
+
* Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
|
523 |
+
* option. If the `multicastInterface` argument
|
524 |
+
* is not specified, the operating system will choose one interface and will add
|
525 |
+
* membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
|
526 |
+
*
|
527 |
+
* When called on an unbound socket, this method will implicitly bind to a random
|
528 |
+
* port, listening on all interfaces.
|
529 |
+
* @since v13.1.0, v12.16.0
|
530 |
+
*/
|
531 |
+
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
532 |
+
/**
|
533 |
+
* Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
|
534 |
+
* automatically called by the kernel when the
|
535 |
+
* socket is closed or the process terminates, so most apps will never have
|
536 |
+
* reason to call this.
|
537 |
+
*
|
538 |
+
* If `multicastInterface` is not specified, the operating system will attempt to
|
539 |
+
* drop membership on all valid interfaces.
|
540 |
+
* @since v13.1.0, v12.16.0
|
541 |
+
*/
|
542 |
+
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
543 |
+
/**
|
544 |
+
* events.EventEmitter
|
545 |
+
* 1. close
|
546 |
+
* 2. connect
|
547 |
+
* 3. error
|
548 |
+
* 4. listening
|
549 |
+
* 5. message
|
550 |
+
*/
|
551 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
552 |
+
addListener(event: "close", listener: () => void): this;
|
553 |
+
addListener(event: "connect", listener: () => void): this;
|
554 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
555 |
+
addListener(event: "listening", listener: () => void): this;
|
556 |
+
addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
557 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
558 |
+
emit(event: "close"): boolean;
|
559 |
+
emit(event: "connect"): boolean;
|
560 |
+
emit(event: "error", err: Error): boolean;
|
561 |
+
emit(event: "listening"): boolean;
|
562 |
+
emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean;
|
563 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
564 |
+
on(event: "close", listener: () => void): this;
|
565 |
+
on(event: "connect", listener: () => void): this;
|
566 |
+
on(event: "error", listener: (err: Error) => void): this;
|
567 |
+
on(event: "listening", listener: () => void): this;
|
568 |
+
on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
569 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
570 |
+
once(event: "close", listener: () => void): this;
|
571 |
+
once(event: "connect", listener: () => void): this;
|
572 |
+
once(event: "error", listener: (err: Error) => void): this;
|
573 |
+
once(event: "listening", listener: () => void): this;
|
574 |
+
once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
575 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
576 |
+
prependListener(event: "close", listener: () => void): this;
|
577 |
+
prependListener(event: "connect", listener: () => void): this;
|
578 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
579 |
+
prependListener(event: "listening", listener: () => void): this;
|
580 |
+
prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
581 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
582 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
583 |
+
prependOnceListener(event: "connect", listener: () => void): this;
|
584 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
585 |
+
prependOnceListener(event: "listening", listener: () => void): this;
|
586 |
+
prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
587 |
+
/**
|
588 |
+
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
589 |
+
* @since v20.5.0
|
590 |
+
*/
|
591 |
+
[Sym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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:diagnostics_channel` module provides an API to create named channels
|
3 |
+
* to report arbitrary message data for diagnostics purposes.
|
4 |
+
*
|
5 |
+
* It can be accessed using:
|
6 |
+
*
|
7 |
+
* ```js
|
8 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
9 |
+
* ```
|
10 |
+
*
|
11 |
+
* It is intended that a module writer wanting to report diagnostics messages
|
12 |
+
* will create one or many top-level channels to report messages through.
|
13 |
+
* Channels may also be acquired at runtime but it is not encouraged
|
14 |
+
* due to the additional overhead of doing so. Channels may be exported for
|
15 |
+
* convenience, but as long as the name is known it can be acquired anywhere.
|
16 |
+
*
|
17 |
+
* If you intend for your module to produce diagnostics data for others to
|
18 |
+
* consume it is recommended that you include documentation of what named
|
19 |
+
* channels are used along with the shape of the message data. Channel names
|
20 |
+
* should generally include the module name to avoid collisions with data from
|
21 |
+
* other modules.
|
22 |
+
* @since v15.1.0, v14.17.0
|
23 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/diagnostics_channel.js)
|
24 |
+
*/
|
25 |
+
declare module "diagnostics_channel" {
|
26 |
+
import { AsyncLocalStorage } from "node:async_hooks";
|
27 |
+
/**
|
28 |
+
* Check if there are active subscribers to the named channel. This is helpful if
|
29 |
+
* the message you want to send might be expensive to prepare.
|
30 |
+
*
|
31 |
+
* This API is optional but helpful when trying to publish messages from very
|
32 |
+
* performance-sensitive code.
|
33 |
+
*
|
34 |
+
* ```js
|
35 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
36 |
+
*
|
37 |
+
* if (diagnostics_channel.hasSubscribers('my-channel')) {
|
38 |
+
* // There are subscribers, prepare and publish message
|
39 |
+
* }
|
40 |
+
* ```
|
41 |
+
* @since v15.1.0, v14.17.0
|
42 |
+
* @param name The channel name
|
43 |
+
* @return If there are active subscribers
|
44 |
+
*/
|
45 |
+
function hasSubscribers(name: string | symbol): boolean;
|
46 |
+
/**
|
47 |
+
* This is the primary entry-point for anyone wanting to publish to a named
|
48 |
+
* channel. It produces a channel object which is optimized to reduce overhead at
|
49 |
+
* publish time as much as possible.
|
50 |
+
*
|
51 |
+
* ```js
|
52 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
53 |
+
*
|
54 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
55 |
+
* ```
|
56 |
+
* @since v15.1.0, v14.17.0
|
57 |
+
* @param name The channel name
|
58 |
+
* @return The named channel object
|
59 |
+
*/
|
60 |
+
function channel(name: string | symbol): Channel;
|
61 |
+
type ChannelListener = (message: unknown, name: string | symbol) => void;
|
62 |
+
/**
|
63 |
+
* Register a message handler to subscribe to this channel. This message handler
|
64 |
+
* will be run synchronously whenever a message is published to the channel. Any
|
65 |
+
* errors thrown in the message handler will trigger an `'uncaughtException'`.
|
66 |
+
*
|
67 |
+
* ```js
|
68 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
69 |
+
*
|
70 |
+
* diagnostics_channel.subscribe('my-channel', (message, name) => {
|
71 |
+
* // Received data
|
72 |
+
* });
|
73 |
+
* ```
|
74 |
+
* @since v18.7.0, v16.17.0
|
75 |
+
* @param name The channel name
|
76 |
+
* @param onMessage The handler to receive channel messages
|
77 |
+
*/
|
78 |
+
function subscribe(name: string | symbol, onMessage: ChannelListener): void;
|
79 |
+
/**
|
80 |
+
* Remove a message handler previously registered to this channel with {@link subscribe}.
|
81 |
+
*
|
82 |
+
* ```js
|
83 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
84 |
+
*
|
85 |
+
* function onMessage(message, name) {
|
86 |
+
* // Received data
|
87 |
+
* }
|
88 |
+
*
|
89 |
+
* diagnostics_channel.subscribe('my-channel', onMessage);
|
90 |
+
*
|
91 |
+
* diagnostics_channel.unsubscribe('my-channel', onMessage);
|
92 |
+
* ```
|
93 |
+
* @since v18.7.0, v16.17.0
|
94 |
+
* @param name The channel name
|
95 |
+
* @param onMessage The previous subscribed handler to remove
|
96 |
+
* @return `true` if the handler was found, `false` otherwise.
|
97 |
+
*/
|
98 |
+
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
|
99 |
+
/**
|
100 |
+
* Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
|
101 |
+
* channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`.
|
102 |
+
*
|
103 |
+
* ```js
|
104 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
105 |
+
*
|
106 |
+
* const channelsByName = diagnostics_channel.tracingChannel('my-channel');
|
107 |
+
*
|
108 |
+
* // or...
|
109 |
+
*
|
110 |
+
* const channelsByCollection = diagnostics_channel.tracingChannel({
|
111 |
+
* start: diagnostics_channel.channel('tracing:my-channel:start'),
|
112 |
+
* end: diagnostics_channel.channel('tracing:my-channel:end'),
|
113 |
+
* asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
|
114 |
+
* asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
|
115 |
+
* error: diagnostics_channel.channel('tracing:my-channel:error'),
|
116 |
+
* });
|
117 |
+
* ```
|
118 |
+
* @since v19.9.0
|
119 |
+
* @experimental
|
120 |
+
* @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
|
121 |
+
* @return Collection of channels to trace with
|
122 |
+
*/
|
123 |
+
function tracingChannel<
|
124 |
+
StoreType = unknown,
|
125 |
+
ContextType extends object = StoreType extends object ? StoreType : object,
|
126 |
+
>(
|
127 |
+
nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>,
|
128 |
+
): TracingChannel<StoreType, ContextType>;
|
129 |
+
/**
|
130 |
+
* The class `Channel` represents an individual named channel within the data
|
131 |
+
* pipeline. It is used to track subscribers and to publish messages when there
|
132 |
+
* are subscribers present. It exists as a separate object to avoid channel
|
133 |
+
* lookups at publish time, enabling very fast publish speeds and allowing
|
134 |
+
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
|
135 |
+
* with `new Channel(name)` is not supported.
|
136 |
+
* @since v15.1.0, v14.17.0
|
137 |
+
*/
|
138 |
+
class Channel<StoreType = unknown, ContextType = StoreType> {
|
139 |
+
readonly name: string | symbol;
|
140 |
+
/**
|
141 |
+
* Check if there are active subscribers to this channel. This is helpful if
|
142 |
+
* the message you want to send might be expensive to prepare.
|
143 |
+
*
|
144 |
+
* This API is optional but helpful when trying to publish messages from very
|
145 |
+
* performance-sensitive code.
|
146 |
+
*
|
147 |
+
* ```js
|
148 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
149 |
+
*
|
150 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
151 |
+
*
|
152 |
+
* if (channel.hasSubscribers) {
|
153 |
+
* // There are subscribers, prepare and publish message
|
154 |
+
* }
|
155 |
+
* ```
|
156 |
+
* @since v15.1.0, v14.17.0
|
157 |
+
*/
|
158 |
+
readonly hasSubscribers: boolean;
|
159 |
+
private constructor(name: string | symbol);
|
160 |
+
/**
|
161 |
+
* Publish a message to any subscribers to the channel. This will trigger
|
162 |
+
* message handlers synchronously so they will execute within the same context.
|
163 |
+
*
|
164 |
+
* ```js
|
165 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
166 |
+
*
|
167 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
168 |
+
*
|
169 |
+
* channel.publish({
|
170 |
+
* some: 'message',
|
171 |
+
* });
|
172 |
+
* ```
|
173 |
+
* @since v15.1.0, v14.17.0
|
174 |
+
* @param message The message to send to the channel subscribers
|
175 |
+
*/
|
176 |
+
publish(message: unknown): void;
|
177 |
+
/**
|
178 |
+
* Register a message handler to subscribe to this channel. This message handler
|
179 |
+
* will be run synchronously whenever a message is published to the channel. Any
|
180 |
+
* errors thrown in the message handler will trigger an `'uncaughtException'`.
|
181 |
+
*
|
182 |
+
* ```js
|
183 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
184 |
+
*
|
185 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
186 |
+
*
|
187 |
+
* channel.subscribe((message, name) => {
|
188 |
+
* // Received data
|
189 |
+
* });
|
190 |
+
* ```
|
191 |
+
* @since v15.1.0, v14.17.0
|
192 |
+
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
|
193 |
+
* @param onMessage The handler to receive channel messages
|
194 |
+
*/
|
195 |
+
subscribe(onMessage: ChannelListener): void;
|
196 |
+
/**
|
197 |
+
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
|
198 |
+
*
|
199 |
+
* ```js
|
200 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
201 |
+
*
|
202 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
203 |
+
*
|
204 |
+
* function onMessage(message, name) {
|
205 |
+
* // Received data
|
206 |
+
* }
|
207 |
+
*
|
208 |
+
* channel.subscribe(onMessage);
|
209 |
+
*
|
210 |
+
* channel.unsubscribe(onMessage);
|
211 |
+
* ```
|
212 |
+
* @since v15.1.0, v14.17.0
|
213 |
+
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
|
214 |
+
* @param onMessage The previous subscribed handler to remove
|
215 |
+
* @return `true` if the handler was found, `false` otherwise.
|
216 |
+
*/
|
217 |
+
unsubscribe(onMessage: ChannelListener): void;
|
218 |
+
/**
|
219 |
+
* When `channel.runStores(context, ...)` is called, the given context data
|
220 |
+
* will be applied to any store bound to the channel. If the store has already been
|
221 |
+
* bound the previous `transform` function will be replaced with the new one.
|
222 |
+
* The `transform` function may be omitted to set the given context data as the
|
223 |
+
* context directly.
|
224 |
+
*
|
225 |
+
* ```js
|
226 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
227 |
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
228 |
+
*
|
229 |
+
* const store = new AsyncLocalStorage();
|
230 |
+
*
|
231 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
232 |
+
*
|
233 |
+
* channel.bindStore(store, (data) => {
|
234 |
+
* return { data };
|
235 |
+
* });
|
236 |
+
* ```
|
237 |
+
* @since v19.9.0
|
238 |
+
* @experimental
|
239 |
+
* @param store The store to which to bind the context data
|
240 |
+
* @param transform Transform context data before setting the store context
|
241 |
+
*/
|
242 |
+
bindStore(store: AsyncLocalStorage<StoreType>, transform?: (context: ContextType) => StoreType): void;
|
243 |
+
/**
|
244 |
+
* Remove a message handler previously registered to this channel with `channel.bindStore(store)`.
|
245 |
+
*
|
246 |
+
* ```js
|
247 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
248 |
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
249 |
+
*
|
250 |
+
* const store = new AsyncLocalStorage();
|
251 |
+
*
|
252 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
253 |
+
*
|
254 |
+
* channel.bindStore(store);
|
255 |
+
* channel.unbindStore(store);
|
256 |
+
* ```
|
257 |
+
* @since v19.9.0
|
258 |
+
* @experimental
|
259 |
+
* @param store The store to unbind from the channel.
|
260 |
+
* @return `true` if the store was found, `false` otherwise.
|
261 |
+
*/
|
262 |
+
unbindStore(store: any): void;
|
263 |
+
/**
|
264 |
+
* Applies the given data to any AsyncLocalStorage instances bound to the channel
|
265 |
+
* for the duration of the given function, then publishes to the channel within
|
266 |
+
* the scope of that data is applied to the stores.
|
267 |
+
*
|
268 |
+
* If a transform function was given to `channel.bindStore(store)` it will be
|
269 |
+
* applied to transform the message data before it becomes the context value for
|
270 |
+
* the store. The prior storage context is accessible from within the transform
|
271 |
+
* function in cases where context linking is required.
|
272 |
+
*
|
273 |
+
* The context applied to the store should be accessible in any async code which
|
274 |
+
* continues from execution which began during the given function, however
|
275 |
+
* there are some situations in which `context loss` may occur.
|
276 |
+
*
|
277 |
+
* ```js
|
278 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
279 |
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
280 |
+
*
|
281 |
+
* const store = new AsyncLocalStorage();
|
282 |
+
*
|
283 |
+
* const channel = diagnostics_channel.channel('my-channel');
|
284 |
+
*
|
285 |
+
* channel.bindStore(store, (message) => {
|
286 |
+
* const parent = store.getStore();
|
287 |
+
* return new Span(message, parent);
|
288 |
+
* });
|
289 |
+
* channel.runStores({ some: 'message' }, () => {
|
290 |
+
* store.getStore(); // Span({ some: 'message' })
|
291 |
+
* });
|
292 |
+
* ```
|
293 |
+
* @since v19.9.0
|
294 |
+
* @experimental
|
295 |
+
* @param context Message to send to subscribers and bind to stores
|
296 |
+
* @param fn Handler to run within the entered storage context
|
297 |
+
* @param thisArg The receiver to be used for the function call.
|
298 |
+
* @param args Optional arguments to pass to the function.
|
299 |
+
*/
|
300 |
+
runStores(): void;
|
301 |
+
}
|
302 |
+
interface TracingChannelSubscribers<ContextType extends object> {
|
303 |
+
start: (message: ContextType) => void;
|
304 |
+
end: (
|
305 |
+
message: ContextType & {
|
306 |
+
error?: unknown;
|
307 |
+
result?: unknown;
|
308 |
+
},
|
309 |
+
) => void;
|
310 |
+
asyncStart: (
|
311 |
+
message: ContextType & {
|
312 |
+
error?: unknown;
|
313 |
+
result?: unknown;
|
314 |
+
},
|
315 |
+
) => void;
|
316 |
+
asyncEnd: (
|
317 |
+
message: ContextType & {
|
318 |
+
error?: unknown;
|
319 |
+
result?: unknown;
|
320 |
+
},
|
321 |
+
) => void;
|
322 |
+
error: (
|
323 |
+
message: ContextType & {
|
324 |
+
error: unknown;
|
325 |
+
},
|
326 |
+
) => void;
|
327 |
+
}
|
328 |
+
interface TracingChannelCollection<StoreType = unknown, ContextType = StoreType> {
|
329 |
+
start: Channel<StoreType, ContextType>;
|
330 |
+
end: Channel<StoreType, ContextType>;
|
331 |
+
asyncStart: Channel<StoreType, ContextType>;
|
332 |
+
asyncEnd: Channel<StoreType, ContextType>;
|
333 |
+
error: Channel<StoreType, ContextType>;
|
334 |
+
}
|
335 |
+
/**
|
336 |
+
* The class `TracingChannel` is a collection of `TracingChannel Channels` which
|
337 |
+
* together express a single traceable action. It is used to formalize and
|
338 |
+
* simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a
|
339 |
+
* single `TracingChannel` at the top-level of the file rather than creating them
|
340 |
+
* dynamically.
|
341 |
+
* @since v19.9.0
|
342 |
+
* @experimental
|
343 |
+
*/
|
344 |
+
class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection {
|
345 |
+
start: Channel<StoreType, ContextType>;
|
346 |
+
end: Channel<StoreType, ContextType>;
|
347 |
+
asyncStart: Channel<StoreType, ContextType>;
|
348 |
+
asyncEnd: Channel<StoreType, ContextType>;
|
349 |
+
error: Channel<StoreType, ContextType>;
|
350 |
+
/**
|
351 |
+
* Helper to subscribe a collection of functions to the corresponding channels.
|
352 |
+
* This is the same as calling `channel.subscribe(onMessage)` on each channel
|
353 |
+
* individually.
|
354 |
+
*
|
355 |
+
* ```js
|
356 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
357 |
+
*
|
358 |
+
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
359 |
+
*
|
360 |
+
* channels.subscribe({
|
361 |
+
* start(message) {
|
362 |
+
* // Handle start message
|
363 |
+
* },
|
364 |
+
* end(message) {
|
365 |
+
* // Handle end message
|
366 |
+
* },
|
367 |
+
* asyncStart(message) {
|
368 |
+
* // Handle asyncStart message
|
369 |
+
* },
|
370 |
+
* asyncEnd(message) {
|
371 |
+
* // Handle asyncEnd message
|
372 |
+
* },
|
373 |
+
* error(message) {
|
374 |
+
* // Handle error message
|
375 |
+
* },
|
376 |
+
* });
|
377 |
+
* ```
|
378 |
+
* @since v19.9.0
|
379 |
+
* @experimental
|
380 |
+
* @param subscribers Set of `TracingChannel Channels` subscribers
|
381 |
+
*/
|
382 |
+
subscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
|
383 |
+
/**
|
384 |
+
* Helper to unsubscribe a collection of functions from the corresponding channels.
|
385 |
+
* This is the same as calling `channel.unsubscribe(onMessage)` on each channel
|
386 |
+
* individually.
|
387 |
+
*
|
388 |
+
* ```js
|
389 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
390 |
+
*
|
391 |
+
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
392 |
+
*
|
393 |
+
* channels.unsubscribe({
|
394 |
+
* start(message) {
|
395 |
+
* // Handle start message
|
396 |
+
* },
|
397 |
+
* end(message) {
|
398 |
+
* // Handle end message
|
399 |
+
* },
|
400 |
+
* asyncStart(message) {
|
401 |
+
* // Handle asyncStart message
|
402 |
+
* },
|
403 |
+
* asyncEnd(message) {
|
404 |
+
* // Handle asyncEnd message
|
405 |
+
* },
|
406 |
+
* error(message) {
|
407 |
+
* // Handle error message
|
408 |
+
* },
|
409 |
+
* });
|
410 |
+
* ```
|
411 |
+
* @since v19.9.0
|
412 |
+
* @experimental
|
413 |
+
* @param subscribers Set of `TracingChannel Channels` subscribers
|
414 |
+
* @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
|
415 |
+
*/
|
416 |
+
unsubscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
|
417 |
+
/**
|
418 |
+
* Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
|
419 |
+
* This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
|
420 |
+
* events should have any bound stores set to match this trace context.
|
421 |
+
*
|
422 |
+
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
|
423 |
+
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
|
424 |
+
*
|
425 |
+
* ```js
|
426 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
427 |
+
*
|
428 |
+
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
429 |
+
*
|
430 |
+
* channels.traceSync(() => {
|
431 |
+
* // Do something
|
432 |
+
* }, {
|
433 |
+
* some: 'thing',
|
434 |
+
* });
|
435 |
+
* ```
|
436 |
+
* @since v19.9.0
|
437 |
+
* @experimental
|
438 |
+
* @param fn Function to wrap a trace around
|
439 |
+
* @param context Shared object to correlate events through
|
440 |
+
* @param thisArg The receiver to be used for the function call
|
441 |
+
* @param args Optional arguments to pass to the function
|
442 |
+
* @return The return value of the given function
|
443 |
+
*/
|
444 |
+
traceSync<ThisArg = any, Args extends any[] = any[]>(
|
445 |
+
fn: (this: ThisArg, ...args: Args) => any,
|
446 |
+
context?: ContextType,
|
447 |
+
thisArg?: ThisArg,
|
448 |
+
...args: Args
|
449 |
+
): void;
|
450 |
+
/**
|
451 |
+
* Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the
|
452 |
+
* function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also
|
453 |
+
* produce an `error event` if the given function throws an error or the
|
454 |
+
* returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
|
455 |
+
* events should have any bound stores set to match this trace context.
|
456 |
+
*
|
457 |
+
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
|
458 |
+
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
|
459 |
+
*
|
460 |
+
* ```js
|
461 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
462 |
+
*
|
463 |
+
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
464 |
+
*
|
465 |
+
* channels.tracePromise(async () => {
|
466 |
+
* // Do something
|
467 |
+
* }, {
|
468 |
+
* some: 'thing',
|
469 |
+
* });
|
470 |
+
* ```
|
471 |
+
* @since v19.9.0
|
472 |
+
* @experimental
|
473 |
+
* @param fn Promise-returning function to wrap a trace around
|
474 |
+
* @param context Shared object to correlate trace events through
|
475 |
+
* @param thisArg The receiver to be used for the function call
|
476 |
+
* @param args Optional arguments to pass to the function
|
477 |
+
* @return Chained from promise returned by the given function
|
478 |
+
*/
|
479 |
+
tracePromise<ThisArg = any, Args extends any[] = any[]>(
|
480 |
+
fn: (this: ThisArg, ...args: Args) => Promise<any>,
|
481 |
+
context?: ContextType,
|
482 |
+
thisArg?: ThisArg,
|
483 |
+
...args: Args
|
484 |
+
): void;
|
485 |
+
/**
|
486 |
+
* Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
|
487 |
+
* function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
|
488 |
+
* the returned
|
489 |
+
* promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
|
490 |
+
* events should have any bound stores set to match this trace context.
|
491 |
+
*
|
492 |
+
* The `position` will be -1 by default to indicate the final argument should
|
493 |
+
* be used as the callback.
|
494 |
+
*
|
495 |
+
* ```js
|
496 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
497 |
+
*
|
498 |
+
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
499 |
+
*
|
500 |
+
* channels.traceCallback((arg1, callback) => {
|
501 |
+
* // Do something
|
502 |
+
* callback(null, 'result');
|
503 |
+
* }, 1, {
|
504 |
+
* some: 'thing',
|
505 |
+
* }, thisArg, arg1, callback);
|
506 |
+
* ```
|
507 |
+
*
|
508 |
+
* The callback will also be run with `channel.runStores(context, ...)` which
|
509 |
+
* enables context loss recovery in some cases.
|
510 |
+
*
|
511 |
+
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
|
512 |
+
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
|
513 |
+
*
|
514 |
+
* ```js
|
515 |
+
* import diagnostics_channel from 'node:diagnostics_channel';
|
516 |
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
517 |
+
*
|
518 |
+
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
519 |
+
* const myStore = new AsyncLocalStorage();
|
520 |
+
*
|
521 |
+
* // The start channel sets the initial store data to something
|
522 |
+
* // and stores that store data value on the trace context object
|
523 |
+
* channels.start.bindStore(myStore, (data) => {
|
524 |
+
* const span = new Span(data);
|
525 |
+
* data.span = span;
|
526 |
+
* return span;
|
527 |
+
* });
|
528 |
+
*
|
529 |
+
* // Then asyncStart can restore from that data it stored previously
|
530 |
+
* channels.asyncStart.bindStore(myStore, (data) => {
|
531 |
+
* return data.span;
|
532 |
+
* });
|
533 |
+
* ```
|
534 |
+
* @since v19.9.0
|
535 |
+
* @experimental
|
536 |
+
* @param fn callback using function to wrap a trace around
|
537 |
+
* @param position Zero-indexed argument position of expected callback
|
538 |
+
* @param context Shared object to correlate trace events through
|
539 |
+
* @param thisArg The receiver to be used for the function call
|
540 |
+
* @param args Optional arguments to pass to the function
|
541 |
+
* @return The return value of the given function
|
542 |
+
*/
|
543 |
+
traceCallback<Fn extends (this: any, ...args: any) => any>(
|
544 |
+
fn: Fn,
|
545 |
+
position: number | undefined,
|
546 |
+
context: ContextType | undefined,
|
547 |
+
thisArg: any,
|
548 |
+
...args: Parameters<Fn>
|
549 |
+
): void;
|
550 |
+
}
|
551 |
+
}
|
552 |
+
declare module "node:diagnostics_channel" {
|
553 |
+
export * from "diagnostics_channel";
|
554 |
+
}
|
workers1/auto3d/node_modules/@types/node/dns.d.ts
ADDED
@@ -0,0 +1,865 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:dns` module enables name resolution. For example, use it to look up IP
|
3 |
+
* addresses of host names.
|
4 |
+
*
|
5 |
+
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
|
6 |
+
* DNS protocol for lookups. {@link lookup} uses the operating system
|
7 |
+
* facilities to perform name resolution. It may not need to perform any network
|
8 |
+
* communication. To perform name resolution the way other applications on the same
|
9 |
+
* system do, use {@link lookup}.
|
10 |
+
*
|
11 |
+
* ```js
|
12 |
+
* const dns = require('node:dns');
|
13 |
+
*
|
14 |
+
* dns.lookup('example.org', (err, address, family) => {
|
15 |
+
* console.log('address: %j family: IPv%s', address, family);
|
16 |
+
* });
|
17 |
+
* // address: "93.184.216.34" family: IPv4
|
18 |
+
* ```
|
19 |
+
*
|
20 |
+
* All other functions in the `node:dns` module connect to an actual DNS server to
|
21 |
+
* perform name resolution. They will always use the network to perform DNS
|
22 |
+
* queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
|
23 |
+
* DNS queries, bypassing other name-resolution facilities.
|
24 |
+
*
|
25 |
+
* ```js
|
26 |
+
* const dns = require('node:dns');
|
27 |
+
*
|
28 |
+
* dns.resolve4('archive.org', (err, addresses) => {
|
29 |
+
* if (err) throw err;
|
30 |
+
*
|
31 |
+
* console.log(`addresses: ${JSON.stringify(addresses)}`);
|
32 |
+
*
|
33 |
+
* addresses.forEach((a) => {
|
34 |
+
* dns.reverse(a, (err, hostnames) => {
|
35 |
+
* if (err) {
|
36 |
+
* throw err;
|
37 |
+
* }
|
38 |
+
* console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
|
39 |
+
* });
|
40 |
+
* });
|
41 |
+
* });
|
42 |
+
* ```
|
43 |
+
*
|
44 |
+
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) for more information.
|
45 |
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dns.js)
|
46 |
+
*/
|
47 |
+
declare module "dns" {
|
48 |
+
import * as dnsPromises from "node:dns/promises";
|
49 |
+
// Supported getaddrinfo flags.
|
50 |
+
/**
|
51 |
+
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
|
52 |
+
* only returned if the current system has at least one IPv4 address configured.
|
53 |
+
*/
|
54 |
+
export const ADDRCONFIG: number;
|
55 |
+
/**
|
56 |
+
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
|
57 |
+
* on some operating systems (e.g. FreeBSD 10.1).
|
58 |
+
*/
|
59 |
+
export const V4MAPPED: number;
|
60 |
+
/**
|
61 |
+
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
62 |
+
* well as IPv4 mapped IPv6 addresses.
|
63 |
+
*/
|
64 |
+
export const ALL: number;
|
65 |
+
export interface LookupOptions {
|
66 |
+
/**
|
67 |
+
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
|
68 |
+
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
|
69 |
+
* with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned.
|
70 |
+
* @default 0
|
71 |
+
*/
|
72 |
+
family?: number | "IPv4" | "IPv6" | undefined;
|
73 |
+
/**
|
74 |
+
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v22.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
|
75 |
+
* passed by bitwise `OR`ing their values.
|
76 |
+
*/
|
77 |
+
hints?: number | undefined;
|
78 |
+
/**
|
79 |
+
* When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
|
80 |
+
* @default false
|
81 |
+
*/
|
82 |
+
all?: boolean | undefined;
|
83 |
+
/**
|
84 |
+
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
|
85 |
+
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
|
86 |
+
* addresses before IPv4 addresses. Default value is configurable using
|
87 |
+
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder).
|
88 |
+
* @default `verbatim` (addresses are not reordered)
|
89 |
+
* @since v22.1.0
|
90 |
+
*/
|
91 |
+
order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
|
92 |
+
/**
|
93 |
+
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
|
94 |
+
* addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
|
95 |
+
* `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
|
96 |
+
* @default true (addresses are not reordered)
|
97 |
+
* @deprecated Please use `order` option
|
98 |
+
*/
|
99 |
+
verbatim?: boolean | undefined;
|
100 |
+
}
|
101 |
+
export interface LookupOneOptions extends LookupOptions {
|
102 |
+
all?: false | undefined;
|
103 |
+
}
|
104 |
+
export interface LookupAllOptions extends LookupOptions {
|
105 |
+
all: true;
|
106 |
+
}
|
107 |
+
export interface LookupAddress {
|
108 |
+
/**
|
109 |
+
* A string representation of an IPv4 or IPv6 address.
|
110 |
+
*/
|
111 |
+
address: string;
|
112 |
+
/**
|
113 |
+
* `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
|
114 |
+
* bug in the name resolution service used by the operating system.
|
115 |
+
*/
|
116 |
+
family: number;
|
117 |
+
}
|
118 |
+
/**
|
119 |
+
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
120 |
+
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
121 |
+
* integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
|
122 |
+
* IPv4 and IPv6 addresses are both returned if found.
|
123 |
+
*
|
124 |
+
* With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the
|
125 |
+
* properties `address` and `family`.
|
126 |
+
*
|
127 |
+
* On error, `err` is an `Error` object, where `err.code` is the error code.
|
128 |
+
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
129 |
+
* the host name does not exist but also when the lookup fails in other ways
|
130 |
+
* such as no available file descriptors.
|
131 |
+
*
|
132 |
+
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
|
133 |
+
* The implementation uses an operating system facility that can associate names
|
134 |
+
* with addresses and vice versa. This implementation can have subtle but
|
135 |
+
* important consequences on the behavior of any Node.js program. Please take some
|
136 |
+
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations)
|
137 |
+
* before using `dns.lookup()`.
|
138 |
+
*
|
139 |
+
* Example usage:
|
140 |
+
*
|
141 |
+
* ```js
|
142 |
+
* const dns = require('node:dns');
|
143 |
+
* const options = {
|
144 |
+
* family: 6,
|
145 |
+
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
146 |
+
* };
|
147 |
+
* dns.lookup('example.com', options, (err, address, family) =>
|
148 |
+
* console.log('address: %j family: IPv%s', address, family));
|
149 |
+
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
150 |
+
*
|
151 |
+
* // When options.all is true, the result will be an Array.
|
152 |
+
* options.all = true;
|
153 |
+
* dns.lookup('example.com', options, (err, addresses) =>
|
154 |
+
* console.log('addresses: %j', addresses));
|
155 |
+
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
156 |
+
* ```
|
157 |
+
*
|
158 |
+
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed
|
159 |
+
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
|
160 |
+
* @since v0.1.90
|
161 |
+
*/
|
162 |
+
export function lookup(
|
163 |
+
hostname: string,
|
164 |
+
family: number,
|
165 |
+
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
166 |
+
): void;
|
167 |
+
export function lookup(
|
168 |
+
hostname: string,
|
169 |
+
options: LookupOneOptions,
|
170 |
+
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
171 |
+
): void;
|
172 |
+
export function lookup(
|
173 |
+
hostname: string,
|
174 |
+
options: LookupAllOptions,
|
175 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
|
176 |
+
): void;
|
177 |
+
export function lookup(
|
178 |
+
hostname: string,
|
179 |
+
options: LookupOptions,
|
180 |
+
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
|
181 |
+
): void;
|
182 |
+
export function lookup(
|
183 |
+
hostname: string,
|
184 |
+
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
185 |
+
): void;
|
186 |
+
export namespace lookup {
|
187 |
+
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
188 |
+
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
189 |
+
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
190 |
+
}
|
191 |
+
/**
|
192 |
+
* Resolves the given `address` and `port` into a host name and service using
|
193 |
+
* the operating system's underlying `getnameinfo` implementation.
|
194 |
+
*
|
195 |
+
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
196 |
+
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
197 |
+
*
|
198 |
+
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object,
|
199 |
+
* where `err.code` is the error code.
|
200 |
+
*
|
201 |
+
* ```js
|
202 |
+
* const dns = require('node:dns');
|
203 |
+
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
204 |
+
* console.log(hostname, service);
|
205 |
+
* // Prints: localhost ssh
|
206 |
+
* });
|
207 |
+
* ```
|
208 |
+
*
|
209 |
+
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed
|
210 |
+
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
|
211 |
+
* @since v0.11.14
|
212 |
+
*/
|
213 |
+
export function lookupService(
|
214 |
+
address: string,
|
215 |
+
port: number,
|
216 |
+
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
|
217 |
+
): void;
|
218 |
+
export namespace lookupService {
|
219 |
+
function __promisify__(
|
220 |
+
address: string,
|
221 |
+
port: number,
|
222 |
+
): Promise<{
|
223 |
+
hostname: string;
|
224 |
+
service: string;
|
225 |
+
}>;
|
226 |
+
}
|
227 |
+
export interface ResolveOptions {
|
228 |
+
ttl: boolean;
|
229 |
+
}
|
230 |
+
export interface ResolveWithTtlOptions extends ResolveOptions {
|
231 |
+
ttl: true;
|
232 |
+
}
|
233 |
+
export interface RecordWithTtl {
|
234 |
+
address: string;
|
235 |
+
ttl: number;
|
236 |
+
}
|
237 |
+
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
|
238 |
+
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
239 |
+
export interface AnyARecord extends RecordWithTtl {
|
240 |
+
type: "A";
|
241 |
+
}
|
242 |
+
export interface AnyAaaaRecord extends RecordWithTtl {
|
243 |
+
type: "AAAA";
|
244 |
+
}
|
245 |
+
export interface CaaRecord {
|
246 |
+
critical: number;
|
247 |
+
issue?: string | undefined;
|
248 |
+
issuewild?: string | undefined;
|
249 |
+
iodef?: string | undefined;
|
250 |
+
contactemail?: string | undefined;
|
251 |
+
contactphone?: string | undefined;
|
252 |
+
}
|
253 |
+
export interface MxRecord {
|
254 |
+
priority: number;
|
255 |
+
exchange: string;
|
256 |
+
}
|
257 |
+
export interface AnyMxRecord extends MxRecord {
|
258 |
+
type: "MX";
|
259 |
+
}
|
260 |
+
export interface NaptrRecord {
|
261 |
+
flags: string;
|
262 |
+
service: string;
|
263 |
+
regexp: string;
|
264 |
+
replacement: string;
|
265 |
+
order: number;
|
266 |
+
preference: number;
|
267 |
+
}
|
268 |
+
export interface AnyNaptrRecord extends NaptrRecord {
|
269 |
+
type: "NAPTR";
|
270 |
+
}
|
271 |
+
export interface SoaRecord {
|
272 |
+
nsname: string;
|
273 |
+
hostmaster: string;
|
274 |
+
serial: number;
|
275 |
+
refresh: number;
|
276 |
+
retry: number;
|
277 |
+
expire: number;
|
278 |
+
minttl: number;
|
279 |
+
}
|
280 |
+
export interface AnySoaRecord extends SoaRecord {
|
281 |
+
type: "SOA";
|
282 |
+
}
|
283 |
+
export interface SrvRecord {
|
284 |
+
priority: number;
|
285 |
+
weight: number;
|
286 |
+
port: number;
|
287 |
+
name: string;
|
288 |
+
}
|
289 |
+
export interface AnySrvRecord extends SrvRecord {
|
290 |
+
type: "SRV";
|
291 |
+
}
|
292 |
+
export interface AnyTxtRecord {
|
293 |
+
type: "TXT";
|
294 |
+
entries: string[];
|
295 |
+
}
|
296 |
+
export interface AnyNsRecord {
|
297 |
+
type: "NS";
|
298 |
+
value: string;
|
299 |
+
}
|
300 |
+
export interface AnyPtrRecord {
|
301 |
+
type: "PTR";
|
302 |
+
value: string;
|
303 |
+
}
|
304 |
+
export interface AnyCnameRecord {
|
305 |
+
type: "CNAME";
|
306 |
+
value: string;
|
307 |
+
}
|
308 |
+
export type AnyRecord =
|
309 |
+
| AnyARecord
|
310 |
+
| AnyAaaaRecord
|
311 |
+
| AnyCnameRecord
|
312 |
+
| AnyMxRecord
|
313 |
+
| AnyNaptrRecord
|
314 |
+
| AnyNsRecord
|
315 |
+
| AnyPtrRecord
|
316 |
+
| AnySoaRecord
|
317 |
+
| AnySrvRecord
|
318 |
+
| AnyTxtRecord;
|
319 |
+
/**
|
320 |
+
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
321 |
+
* of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource
|
322 |
+
* records. The type and structure of individual results varies based on `rrtype`:
|
323 |
+
*
|
324 |
+
* <omitted>
|
325 |
+
*
|
326 |
+
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object,
|
327 |
+
* where `err.code` is one of the `DNS error codes`.
|
328 |
+
* @since v0.1.27
|
329 |
+
* @param hostname Host name to resolve.
|
330 |
+
* @param [rrtype='A'] Resource record type.
|
331 |
+
*/
|
332 |
+
export function resolve(
|
333 |
+
hostname: string,
|
334 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
335 |
+
): void;
|
336 |
+
export function resolve(
|
337 |
+
hostname: string,
|
338 |
+
rrtype: "A",
|
339 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
340 |
+
): void;
|
341 |
+
export function resolve(
|
342 |
+
hostname: string,
|
343 |
+
rrtype: "AAAA",
|
344 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
345 |
+
): void;
|
346 |
+
export function resolve(
|
347 |
+
hostname: string,
|
348 |
+
rrtype: "ANY",
|
349 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
350 |
+
): void;
|
351 |
+
export function resolve(
|
352 |
+
hostname: string,
|
353 |
+
rrtype: "CNAME",
|
354 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
355 |
+
): void;
|
356 |
+
export function resolve(
|
357 |
+
hostname: string,
|
358 |
+
rrtype: "MX",
|
359 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
360 |
+
): void;
|
361 |
+
export function resolve(
|
362 |
+
hostname: string,
|
363 |
+
rrtype: "NAPTR",
|
364 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
365 |
+
): void;
|
366 |
+
export function resolve(
|
367 |
+
hostname: string,
|
368 |
+
rrtype: "NS",
|
369 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
370 |
+
): void;
|
371 |
+
export function resolve(
|
372 |
+
hostname: string,
|
373 |
+
rrtype: "PTR",
|
374 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
375 |
+
): void;
|
376 |
+
export function resolve(
|
377 |
+
hostname: string,
|
378 |
+
rrtype: "SOA",
|
379 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
|
380 |
+
): void;
|
381 |
+
export function resolve(
|
382 |
+
hostname: string,
|
383 |
+
rrtype: "SRV",
|
384 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
385 |
+
): void;
|
386 |
+
export function resolve(
|
387 |
+
hostname: string,
|
388 |
+
rrtype: "TXT",
|
389 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
390 |
+
): void;
|
391 |
+
export function resolve(
|
392 |
+
hostname: string,
|
393 |
+
rrtype: string,
|
394 |
+
callback: (
|
395 |
+
err: NodeJS.ErrnoException | null,
|
396 |
+
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
|
397 |
+
) => void,
|
398 |
+
): void;
|
399 |
+
export namespace resolve {
|
400 |
+
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
401 |
+
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
402 |
+
function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
403 |
+
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
404 |
+
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
405 |
+
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
406 |
+
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
407 |
+
function __promisify__(
|
408 |
+
hostname: string,
|
409 |
+
rrtype: string,
|
410 |
+
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
411 |
+
}
|
412 |
+
/**
|
413 |
+
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
|
414 |
+
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
415 |
+
* @since v0.1.16
|
416 |
+
* @param hostname Host name to resolve.
|
417 |
+
*/
|
418 |
+
export function resolve4(
|
419 |
+
hostname: string,
|
420 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
421 |
+
): void;
|
422 |
+
export function resolve4(
|
423 |
+
hostname: string,
|
424 |
+
options: ResolveWithTtlOptions,
|
425 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
426 |
+
): void;
|
427 |
+
export function resolve4(
|
428 |
+
hostname: string,
|
429 |
+
options: ResolveOptions,
|
430 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
431 |
+
): void;
|
432 |
+
export namespace resolve4 {
|
433 |
+
function __promisify__(hostname: string): Promise<string[]>;
|
434 |
+
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
435 |
+
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
436 |
+
}
|
437 |
+
/**
|
438 |
+
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function
|
439 |
+
* will contain an array of IPv6 addresses.
|
440 |
+
* @since v0.1.16
|
441 |
+
* @param hostname Host name to resolve.
|
442 |
+
*/
|
443 |
+
export function resolve6(
|
444 |
+
hostname: string,
|
445 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
446 |
+
): void;
|
447 |
+
export function resolve6(
|
448 |
+
hostname: string,
|
449 |
+
options: ResolveWithTtlOptions,
|
450 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
451 |
+
): void;
|
452 |
+
export function resolve6(
|
453 |
+
hostname: string,
|
454 |
+
options: ResolveOptions,
|
455 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
456 |
+
): void;
|
457 |
+
export namespace resolve6 {
|
458 |
+
function __promisify__(hostname: string): Promise<string[]>;
|
459 |
+
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
460 |
+
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
461 |
+
}
|
462 |
+
/**
|
463 |
+
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function
|
464 |
+
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
|
465 |
+
* @since v0.3.2
|
466 |
+
*/
|
467 |
+
export function resolveCname(
|
468 |
+
hostname: string,
|
469 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
470 |
+
): void;
|
471 |
+
export namespace resolveCname {
|
472 |
+
function __promisify__(hostname: string): Promise<string[]>;
|
473 |
+
}
|
474 |
+
/**
|
475 |
+
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function
|
476 |
+
* will contain an array of certification authority authorization records
|
477 |
+
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:[email protected]'}, {critical: 128, issue: 'pki.example.com'}]`).
|
478 |
+
* @since v15.0.0, v14.17.0
|
479 |
+
*/
|
480 |
+
export function resolveCaa(
|
481 |
+
hostname: string,
|
482 |
+
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
|
483 |
+
): void;
|
484 |
+
export namespace resolveCaa {
|
485 |
+
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
486 |
+
}
|
487 |
+
/**
|
488 |
+
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
489 |
+
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
490 |
+
* @since v0.1.27
|
491 |
+
*/
|
492 |
+
export function resolveMx(
|
493 |
+
hostname: string,
|
494 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
495 |
+
): void;
|
496 |
+
export namespace resolveMx {
|
497 |
+
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
498 |
+
}
|
499 |
+
/**
|
500 |
+
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of
|
501 |
+
* objects with the following properties:
|
502 |
+
*
|
503 |
+
* * `flags`
|
504 |
+
* * `service`
|
505 |
+
* * `regexp`
|
506 |
+
* * `replacement`
|
507 |
+
* * `order`
|
508 |
+
* * `preference`
|
509 |
+
*
|
510 |
+
* ```js
|
511 |
+
* {
|
512 |
+
* flags: 's',
|
513 |
+
* service: 'SIP+D2U',
|
514 |
+
* regexp: '',
|
515 |
+
* replacement: '_sip._udp.example.com',
|
516 |
+
* order: 30,
|
517 |
+
* preference: 100
|
518 |
+
* }
|
519 |
+
* ```
|
520 |
+
* @since v0.9.12
|
521 |
+
*/
|
522 |
+
export function resolveNaptr(
|
523 |
+
hostname: string,
|
524 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
525 |
+
): void;
|
526 |
+
export namespace resolveNaptr {
|
527 |
+
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
528 |
+
}
|
529 |
+
/**
|
530 |
+
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
531 |
+
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
|
532 |
+
* @since v0.1.90
|
533 |
+
*/
|
534 |
+
export function resolveNs(
|
535 |
+
hostname: string,
|
536 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
537 |
+
): void;
|
538 |
+
export namespace resolveNs {
|
539 |
+
function __promisify__(hostname: string): Promise<string[]>;
|
540 |
+
}
|
541 |
+
/**
|
542 |
+
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
543 |
+
* be an array of strings containing the reply records.
|
544 |
+
* @since v6.0.0
|
545 |
+
*/
|
546 |
+
export function resolvePtr(
|
547 |
+
hostname: string,
|
548 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
549 |
+
): void;
|
550 |
+
export namespace resolvePtr {
|
551 |
+
function __promisify__(hostname: string): Promise<string[]>;
|
552 |
+
}
|
553 |
+
/**
|
554 |
+
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
555 |
+
* the `hostname`. The `address` argument passed to the `callback` function will
|
556 |
+
* be an object with the following properties:
|
557 |
+
*
|
558 |
+
* * `nsname`
|
559 |
+
* * `hostmaster`
|
560 |
+
* * `serial`
|
561 |
+
* * `refresh`
|
562 |
+
* * `retry`
|
563 |
+
* * `expire`
|
564 |
+
* * `minttl`
|
565 |
+
*
|
566 |
+
* ```js
|
567 |
+
* {
|
568 |
+
* nsname: 'ns.example.com',
|
569 |
+
* hostmaster: 'root.example.com',
|
570 |
+
* serial: 2013101809,
|
571 |
+
* refresh: 10000,
|
572 |
+
* retry: 2400,
|
573 |
+
* expire: 604800,
|
574 |
+
* minttl: 3600
|
575 |
+
* }
|
576 |
+
* ```
|
577 |
+
* @since v0.11.10
|
578 |
+
*/
|
579 |
+
export function resolveSoa(
|
580 |
+
hostname: string,
|
581 |
+
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
|
582 |
+
): void;
|
583 |
+
export namespace resolveSoa {
|
584 |
+
function __promisify__(hostname: string): Promise<SoaRecord>;
|
585 |
+
}
|
586 |
+
/**
|
587 |
+
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
588 |
+
* be an array of objects with the following properties:
|
589 |
+
*
|
590 |
+
* * `priority`
|
591 |
+
* * `weight`
|
592 |
+
* * `port`
|
593 |
+
* * `name`
|
594 |
+
*
|
595 |
+
* ```js
|
596 |
+
* {
|
597 |
+
* priority: 10,
|
598 |
+
* weight: 5,
|
599 |
+
* port: 21223,
|
600 |
+
* name: 'service.example.com'
|
601 |
+
* }
|
602 |
+
* ```
|
603 |
+
* @since v0.1.27
|
604 |
+
*/
|
605 |
+
export function resolveSrv(
|
606 |
+
hostname: string,
|
607 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
608 |
+
): void;
|
609 |
+
export namespace resolveSrv {
|
610 |
+
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
611 |
+
}
|
612 |
+
/**
|
613 |
+
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
|
614 |
+
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
615 |
+
* one record. Depending on the use case, these could be either joined together or
|
616 |
+
* treated separately.
|
617 |
+
* @since v0.1.27
|
618 |
+
*/
|
619 |
+
export function resolveTxt(
|
620 |
+
hostname: string,
|
621 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
622 |
+
): void;
|
623 |
+
export namespace resolveTxt {
|
624 |
+
function __promisify__(hostname: string): Promise<string[][]>;
|
625 |
+
}
|
626 |
+
/**
|
627 |
+
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
628 |
+
* The `ret` argument passed to the `callback` function will be an array containing
|
629 |
+
* various types of records. Each object has a property `type` that indicates the
|
630 |
+
* type of the current record. And depending on the `type`, additional properties
|
631 |
+
* will be present on the object:
|
632 |
+
*
|
633 |
+
* <omitted>
|
634 |
+
*
|
635 |
+
* Here is an example of the `ret` object passed to the callback:
|
636 |
+
*
|
637 |
+
* ```js
|
638 |
+
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
639 |
+
* { type: 'CNAME', value: 'example.com' },
|
640 |
+
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
641 |
+
* { type: 'NS', value: 'ns1.example.com' },
|
642 |
+
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
643 |
+
* { type: 'SOA',
|
644 |
+
* nsname: 'ns1.example.com',
|
645 |
+
* hostmaster: 'admin.example.com',
|
646 |
+
* serial: 156696742,
|
647 |
+
* refresh: 900,
|
648 |
+
* retry: 900,
|
649 |
+
* expire: 1800,
|
650 |
+
* minttl: 60 } ]
|
651 |
+
* ```
|
652 |
+
*
|
653 |
+
* DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
|
654 |
+
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
|
655 |
+
*/
|
656 |
+
export function resolveAny(
|
657 |
+
hostname: string,
|
658 |
+
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
659 |
+
): void;
|
660 |
+
export namespace resolveAny {
|
661 |
+
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
662 |
+
}
|
663 |
+
/**
|
664 |
+
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
665 |
+
* array of host names.
|
666 |
+
*
|
667 |
+
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, where `err.code` is
|
668 |
+
* one of the [DNS error codes](https://nodejs.org/docs/latest-v22.x/api/dns.html#error-codes).
|
669 |
+
* @since v0.1.16
|
670 |
+
*/
|
671 |
+
export function reverse(
|
672 |
+
ip: string,
|
673 |
+
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
|
674 |
+
): void;
|
675 |
+
/**
|
676 |
+
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
|
677 |
+
* The value could be:
|
678 |
+
*
|
679 |
+
* * `ipv4first`: for `order` defaulting to `ipv4first`.
|
680 |
+
* * `ipv6first`: for `order` defaulting to `ipv6first`.
|
681 |
+
* * `verbatim`: for `order` defaulting to `verbatim`.
|
682 |
+
* @since v18.17.0
|
683 |
+
*/
|
684 |
+
export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
|
685 |
+
/**
|
686 |
+
* Sets the IP address and port of servers to be used when performing DNS
|
687 |
+
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
688 |
+
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
689 |
+
*
|
690 |
+
* ```js
|
691 |
+
* dns.setServers([
|
692 |
+
* '4.4.4.4',
|
693 |
+
* '[2001:4860:4860::8888]',
|
694 |
+
* '4.4.4.4:1053',
|
695 |
+
* '[2001:4860:4860::8888]:1053',
|
696 |
+
* ]);
|
697 |
+
* ```
|
698 |
+
*
|
699 |
+
* An error will be thrown if an invalid address is provided.
|
700 |
+
*
|
701 |
+
* The `dns.setServers()` method must not be called while a DNS query is in
|
702 |
+
* progress.
|
703 |
+
*
|
704 |
+
* The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
|
705 |
+
*
|
706 |
+
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
707 |
+
* That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
708 |
+
* subsequent servers provided. Fallback DNS servers will only be used if the
|
709 |
+
* earlier ones time out or result in some other error.
|
710 |
+
* @since v0.11.3
|
711 |
+
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
|
712 |
+
*/
|
713 |
+
export function setServers(servers: readonly string[]): void;
|
714 |
+
/**
|
715 |
+
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
716 |
+
* that are currently configured for DNS resolution. A string will include a port
|
717 |
+
* section if a custom port is used.
|
718 |
+
*
|
719 |
+
* ```js
|
720 |
+
* [
|
721 |
+
* '4.4.4.4',
|
722 |
+
* '2001:4860:4860::8888',
|
723 |
+
* '4.4.4.4:1053',
|
724 |
+
* '[2001:4860:4860::8888]:1053',
|
725 |
+
* ]
|
726 |
+
* ```
|
727 |
+
* @since v0.11.3
|
728 |
+
*/
|
729 |
+
export function getServers(): string[];
|
730 |
+
/**
|
731 |
+
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
|
732 |
+
* The value could be:
|
733 |
+
*
|
734 |
+
* * `ipv4first`: sets default `order` to `ipv4first`.
|
735 |
+
* * `ipv6first`: sets default `order` to `ipv6first`.
|
736 |
+
* * `verbatim`: sets default `order` to `verbatim`.
|
737 |
+
*
|
738 |
+
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
|
739 |
+
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using
|
740 |
+
* [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
|
741 |
+
* thread won't affect the default dns orders in workers.
|
742 |
+
* @since v16.4.0, v14.18.0
|
743 |
+
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
744 |
+
*/
|
745 |
+
export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
746 |
+
// Error codes
|
747 |
+
export const NODATA: "ENODATA";
|
748 |
+
export const FORMERR: "EFORMERR";
|
749 |
+
export const SERVFAIL: "ESERVFAIL";
|
750 |
+
export const NOTFOUND: "ENOTFOUND";
|
751 |
+
export const NOTIMP: "ENOTIMP";
|
752 |
+
export const REFUSED: "EREFUSED";
|
753 |
+
export const BADQUERY: "EBADQUERY";
|
754 |
+
export const BADNAME: "EBADNAME";
|
755 |
+
export const BADFAMILY: "EBADFAMILY";
|
756 |
+
export const BADRESP: "EBADRESP";
|
757 |
+
export const CONNREFUSED: "ECONNREFUSED";
|
758 |
+
export const TIMEOUT: "ETIMEOUT";
|
759 |
+
export const EOF: "EOF";
|
760 |
+
export const FILE: "EFILE";
|
761 |
+
export const NOMEM: "ENOMEM";
|
762 |
+
export const DESTRUCTION: "EDESTRUCTION";
|
763 |
+
export const BADSTR: "EBADSTR";
|
764 |
+
export const BADFLAGS: "EBADFLAGS";
|
765 |
+
export const NONAME: "ENONAME";
|
766 |
+
export const BADHINTS: "EBADHINTS";
|
767 |
+
export const NOTINITIALIZED: "ENOTINITIALIZED";
|
768 |
+
export const LOADIPHLPAPI: "ELOADIPHLPAPI";
|
769 |
+
export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
|
770 |
+
export const CANCELLED: "ECANCELLED";
|
771 |
+
export interface ResolverOptions {
|
772 |
+
/**
|
773 |
+
* Query timeout in milliseconds, or `-1` to use the default timeout.
|
774 |
+
*/
|
775 |
+
timeout?: number | undefined;
|
776 |
+
/**
|
777 |
+
* The number of tries the resolver will try contacting each name server before giving up.
|
778 |
+
* @default 4
|
779 |
+
*/
|
780 |
+
tries?: number;
|
781 |
+
}
|
782 |
+
/**
|
783 |
+
* An independent resolver for DNS requests.
|
784 |
+
*
|
785 |
+
* Creating a new resolver uses the default server settings. Setting
|
786 |
+
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnssetserversservers) does not affect
|
787 |
+
* other resolvers:
|
788 |
+
*
|
789 |
+
* ```js
|
790 |
+
* const { Resolver } = require('node:dns');
|
791 |
+
* const resolver = new Resolver();
|
792 |
+
* resolver.setServers(['4.4.4.4']);
|
793 |
+
*
|
794 |
+
* // This request will use the server at 4.4.4.4, independent of global settings.
|
795 |
+
* resolver.resolve4('example.org', (err, addresses) => {
|
796 |
+
* // ...
|
797 |
+
* });
|
798 |
+
* ```
|
799 |
+
*
|
800 |
+
* The following methods from the `node:dns` module are available:
|
801 |
+
*
|
802 |
+
* * `resolver.getServers()`
|
803 |
+
* * `resolver.resolve()`
|
804 |
+
* * `resolver.resolve4()`
|
805 |
+
* * `resolver.resolve6()`
|
806 |
+
* * `resolver.resolveAny()`
|
807 |
+
* * `resolver.resolveCaa()`
|
808 |
+
* * `resolver.resolveCname()`
|
809 |
+
* * `resolver.resolveMx()`
|
810 |
+
* * `resolver.resolveNaptr()`
|
811 |
+
* * `resolver.resolveNs()`
|
812 |
+
* * `resolver.resolvePtr()`
|
813 |
+
* * `resolver.resolveSoa()`
|
814 |
+
* * `resolver.resolveSrv()`
|
815 |
+
* * `resolver.resolveTxt()`
|
816 |
+
* * `resolver.reverse()`
|
817 |
+
* * `resolver.setServers()`
|
818 |
+
* @since v8.3.0
|
819 |
+
*/
|
820 |
+
export class Resolver {
|
821 |
+
constructor(options?: ResolverOptions);
|
822 |
+
/**
|
823 |
+
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
824 |
+
* callbacks will be called with an error with code `ECANCELLED`.
|
825 |
+
* @since v8.3.0
|
826 |
+
*/
|
827 |
+
cancel(): void;
|
828 |
+
getServers: typeof getServers;
|
829 |
+
resolve: typeof resolve;
|
830 |
+
resolve4: typeof resolve4;
|
831 |
+
resolve6: typeof resolve6;
|
832 |
+
resolveAny: typeof resolveAny;
|
833 |
+
resolveCaa: typeof resolveCaa;
|
834 |
+
resolveCname: typeof resolveCname;
|
835 |
+
resolveMx: typeof resolveMx;
|
836 |
+
resolveNaptr: typeof resolveNaptr;
|
837 |
+
resolveNs: typeof resolveNs;
|
838 |
+
resolvePtr: typeof resolvePtr;
|
839 |
+
resolveSoa: typeof resolveSoa;
|
840 |
+
resolveSrv: typeof resolveSrv;
|
841 |
+
resolveTxt: typeof resolveTxt;
|
842 |
+
reverse: typeof reverse;
|
843 |
+
/**
|
844 |
+
* The resolver instance will send its requests from the specified IP address.
|
845 |
+
* This allows programs to specify outbound interfaces when used on multi-homed
|
846 |
+
* systems.
|
847 |
+
*
|
848 |
+
* If a v4 or v6 address is not specified, it is set to the default and the
|
849 |
+
* operating system will choose a local address automatically.
|
850 |
+
*
|
851 |
+
* The resolver will use the v4 local address when making requests to IPv4 DNS
|
852 |
+
* servers, and the v6 local address when making requests to IPv6 DNS servers.
|
853 |
+
* The `rrtype` of resolution requests has no impact on the local address used.
|
854 |
+
* @since v15.1.0, v14.17.0
|
855 |
+
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
856 |
+
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
857 |
+
*/
|
858 |
+
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
859 |
+
setServers: typeof setServers;
|
860 |
+
}
|
861 |
+
export { dnsPromises as promises };
|
862 |
+
}
|
863 |
+
declare module "node:dns" {
|
864 |
+
export * from "dns";
|
865 |
+
}
|
workers1/auto3d/node_modules/@types/node/dns/promises.d.ts
ADDED
@@ -0,0 +1,476 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
3 |
+
* that return `Promise` objects rather than using callbacks. The API is accessible
|
4 |
+
* via `require('node:dns').promises` or `require('node:dns/promises')`.
|
5 |
+
* @since v10.6.0
|
6 |
+
*/
|
7 |
+
declare module "dns/promises" {
|
8 |
+
import {
|
9 |
+
AnyRecord,
|
10 |
+
CaaRecord,
|
11 |
+
LookupAddress,
|
12 |
+
LookupAllOptions,
|
13 |
+
LookupOneOptions,
|
14 |
+
LookupOptions,
|
15 |
+
MxRecord,
|
16 |
+
NaptrRecord,
|
17 |
+
RecordWithTtl,
|
18 |
+
ResolveOptions,
|
19 |
+
ResolverOptions,
|
20 |
+
ResolveWithTtlOptions,
|
21 |
+
SoaRecord,
|
22 |
+
SrvRecord,
|
23 |
+
} from "node:dns";
|
24 |
+
/**
|
25 |
+
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
26 |
+
* that are currently configured for DNS resolution. A string will include a port
|
27 |
+
* section if a custom port is used.
|
28 |
+
*
|
29 |
+
* ```js
|
30 |
+
* [
|
31 |
+
* '4.4.4.4',
|
32 |
+
* '2001:4860:4860::8888',
|
33 |
+
* '4.4.4.4:1053',
|
34 |
+
* '[2001:4860:4860::8888]:1053',
|
35 |
+
* ]
|
36 |
+
* ```
|
37 |
+
* @since v10.6.0
|
38 |
+
*/
|
39 |
+
function getServers(): string[];
|
40 |
+
/**
|
41 |
+
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
42 |
+
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
43 |
+
* integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
|
44 |
+
* and IPv6 addresses are both returned if found.
|
45 |
+
*
|
46 |
+
* With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`.
|
47 |
+
*
|
48 |
+
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
49 |
+
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
50 |
+
* the host name does not exist but also when the lookup fails in other ways
|
51 |
+
* such as no available file descriptors.
|
52 |
+
*
|
53 |
+
* [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS
|
54 |
+
* protocol. The implementation uses an operating system facility that can
|
55 |
+
* associate names with addresses and vice versa. This implementation can have
|
56 |
+
* subtle but important consequences on the behavior of any Node.js program. Please
|
57 |
+
* take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) before
|
58 |
+
* using `dnsPromises.lookup()`.
|
59 |
+
*
|
60 |
+
* Example usage:
|
61 |
+
*
|
62 |
+
* ```js
|
63 |
+
* const dns = require('node:dns');
|
64 |
+
* const dnsPromises = dns.promises;
|
65 |
+
* const options = {
|
66 |
+
* family: 6,
|
67 |
+
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
68 |
+
* };
|
69 |
+
*
|
70 |
+
* dnsPromises.lookup('example.com', options).then((result) => {
|
71 |
+
* console.log('address: %j family: IPv%s', result.address, result.family);
|
72 |
+
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
73 |
+
* });
|
74 |
+
*
|
75 |
+
* // When options.all is true, the result will be an Array.
|
76 |
+
* options.all = true;
|
77 |
+
* dnsPromises.lookup('example.com', options).then((result) => {
|
78 |
+
* console.log('addresses: %j', result);
|
79 |
+
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
80 |
+
* });
|
81 |
+
* ```
|
82 |
+
* @since v10.6.0
|
83 |
+
*/
|
84 |
+
function lookup(hostname: string, family: number): Promise<LookupAddress>;
|
85 |
+
function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
|
86 |
+
function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
87 |
+
function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
88 |
+
function lookup(hostname: string): Promise<LookupAddress>;
|
89 |
+
/**
|
90 |
+
* Resolves the given `address` and `port` into a host name and service using
|
91 |
+
* the operating system's underlying `getnameinfo` implementation.
|
92 |
+
*
|
93 |
+
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
94 |
+
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
95 |
+
*
|
96 |
+
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
97 |
+
*
|
98 |
+
* ```js
|
99 |
+
* const dnsPromises = require('node:dns').promises;
|
100 |
+
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
|
101 |
+
* console.log(result.hostname, result.service);
|
102 |
+
* // Prints: localhost ssh
|
103 |
+
* });
|
104 |
+
* ```
|
105 |
+
* @since v10.6.0
|
106 |
+
*/
|
107 |
+
function lookupService(
|
108 |
+
address: string,
|
109 |
+
port: number,
|
110 |
+
): Promise<{
|
111 |
+
hostname: string;
|
112 |
+
service: string;
|
113 |
+
}>;
|
114 |
+
/**
|
115 |
+
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
116 |
+
* of the resource records. When successful, the `Promise` is resolved with an
|
117 |
+
* array of resource records. The type and structure of individual results vary
|
118 |
+
* based on `rrtype`:
|
119 |
+
*
|
120 |
+
* <omitted>
|
121 |
+
*
|
122 |
+
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code`
|
123 |
+
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
|
124 |
+
* @since v10.6.0
|
125 |
+
* @param hostname Host name to resolve.
|
126 |
+
* @param [rrtype='A'] Resource record type.
|
127 |
+
*/
|
128 |
+
function resolve(hostname: string): Promise<string[]>;
|
129 |
+
function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
|
130 |
+
function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
|
131 |
+
function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
132 |
+
function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
133 |
+
function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
|
134 |
+
function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
135 |
+
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
136 |
+
function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
|
137 |
+
function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
|
138 |
+
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
139 |
+
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
140 |
+
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
141 |
+
function resolve(
|
142 |
+
hostname: string,
|
143 |
+
rrtype: string,
|
144 |
+
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
145 |
+
/**
|
146 |
+
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4
|
147 |
+
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
148 |
+
* @since v10.6.0
|
149 |
+
* @param hostname Host name to resolve.
|
150 |
+
*/
|
151 |
+
function resolve4(hostname: string): Promise<string[]>;
|
152 |
+
function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
153 |
+
function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
154 |
+
/**
|
155 |
+
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6
|
156 |
+
* addresses.
|
157 |
+
* @since v10.6.0
|
158 |
+
* @param hostname Host name to resolve.
|
159 |
+
*/
|
160 |
+
function resolve6(hostname: string): Promise<string[]>;
|
161 |
+
function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
162 |
+
function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
163 |
+
/**
|
164 |
+
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
165 |
+
* On success, the `Promise` is resolved with an array containing various types of
|
166 |
+
* records. Each object has a property `type` that indicates the type of the
|
167 |
+
* current record. And depending on the `type`, additional properties will be
|
168 |
+
* present on the object:
|
169 |
+
*
|
170 |
+
* <omitted>
|
171 |
+
*
|
172 |
+
* Here is an example of the result object:
|
173 |
+
*
|
174 |
+
* ```js
|
175 |
+
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
176 |
+
* { type: 'CNAME', value: 'example.com' },
|
177 |
+
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
178 |
+
* { type: 'NS', value: 'ns1.example.com' },
|
179 |
+
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
180 |
+
* { type: 'SOA',
|
181 |
+
* nsname: 'ns1.example.com',
|
182 |
+
* hostmaster: 'admin.example.com',
|
183 |
+
* serial: 156696742,
|
184 |
+
* refresh: 900,
|
185 |
+
* retry: 900,
|
186 |
+
* expire: 1800,
|
187 |
+
* minttl: 60 } ]
|
188 |
+
* ```
|
189 |
+
* @since v10.6.0
|
190 |
+
*/
|
191 |
+
function resolveAny(hostname: string): Promise<AnyRecord[]>;
|
192 |
+
/**
|
193 |
+
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
|
194 |
+
* the `Promise` is resolved with an array of objects containing available
|
195 |
+
* certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:[email protected]'},{critical: 128, issue: 'pki.example.com'}]`).
|
196 |
+
* @since v15.0.0, v14.17.0
|
197 |
+
*/
|
198 |
+
function resolveCaa(hostname: string): Promise<CaaRecord[]>;
|
199 |
+
/**
|
200 |
+
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success,
|
201 |
+
* the `Promise` is resolved with an array of canonical name records available for
|
202 |
+
* the `hostname` (e.g. `['bar.example.com']`).
|
203 |
+
* @since v10.6.0
|
204 |
+
*/
|
205 |
+
function resolveCname(hostname: string): Promise<string[]>;
|
206 |
+
/**
|
207 |
+
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects
|
208 |
+
* containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
209 |
+
* @since v10.6.0
|
210 |
+
*/
|
211 |
+
function resolveMx(hostname: string): Promise<MxRecord[]>;
|
212 |
+
/**
|
213 |
+
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array
|
214 |
+
* of objects with the following properties:
|
215 |
+
*
|
216 |
+
* * `flags`
|
217 |
+
* * `service`
|
218 |
+
* * `regexp`
|
219 |
+
* * `replacement`
|
220 |
+
* * `order`
|
221 |
+
* * `preference`
|
222 |
+
*
|
223 |
+
* ```js
|
224 |
+
* {
|
225 |
+
* flags: 's',
|
226 |
+
* service: 'SIP+D2U',
|
227 |
+
* regexp: '',
|
228 |
+
* replacement: '_sip._udp.example.com',
|
229 |
+
* order: 30,
|
230 |
+
* preference: 100
|
231 |
+
* }
|
232 |
+
* ```
|
233 |
+
* @since v10.6.0
|
234 |
+
*/
|
235 |
+
function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
|
236 |
+
/**
|
237 |
+
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server
|
238 |
+
* records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
|
239 |
+
* @since v10.6.0
|
240 |
+
*/
|
241 |
+
function resolveNs(hostname: string): Promise<string[]>;
|
242 |
+
/**
|
243 |
+
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings
|
244 |
+
* containing the reply records.
|
245 |
+
* @since v10.6.0
|
246 |
+
*/
|
247 |
+
function resolvePtr(hostname: string): Promise<string[]>;
|
248 |
+
/**
|
249 |
+
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
250 |
+
* the `hostname`. On success, the `Promise` is resolved with an object with the
|
251 |
+
* following properties:
|
252 |
+
*
|
253 |
+
* * `nsname`
|
254 |
+
* * `hostmaster`
|
255 |
+
* * `serial`
|
256 |
+
* * `refresh`
|
257 |
+
* * `retry`
|
258 |
+
* * `expire`
|
259 |
+
* * `minttl`
|
260 |
+
*
|
261 |
+
* ```js
|
262 |
+
* {
|
263 |
+
* nsname: 'ns.example.com',
|
264 |
+
* hostmaster: 'root.example.com',
|
265 |
+
* serial: 2013101809,
|
266 |
+
* refresh: 10000,
|
267 |
+
* retry: 2400,
|
268 |
+
* expire: 604800,
|
269 |
+
* minttl: 3600
|
270 |
+
* }
|
271 |
+
* ```
|
272 |
+
* @since v10.6.0
|
273 |
+
*/
|
274 |
+
function resolveSoa(hostname: string): Promise<SoaRecord>;
|
275 |
+
/**
|
276 |
+
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with
|
277 |
+
* the following properties:
|
278 |
+
*
|
279 |
+
* * `priority`
|
280 |
+
* * `weight`
|
281 |
+
* * `port`
|
282 |
+
* * `name`
|
283 |
+
*
|
284 |
+
* ```js
|
285 |
+
* {
|
286 |
+
* priority: 10,
|
287 |
+
* weight: 5,
|
288 |
+
* port: 21223,
|
289 |
+
* name: 'service.example.com'
|
290 |
+
* }
|
291 |
+
* ```
|
292 |
+
* @since v10.6.0
|
293 |
+
*/
|
294 |
+
function resolveSrv(hostname: string): Promise<SrvRecord[]>;
|
295 |
+
/**
|
296 |
+
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
|
297 |
+
* of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
298 |
+
* one record. Depending on the use case, these could be either joined together or
|
299 |
+
* treated separately.
|
300 |
+
* @since v10.6.0
|
301 |
+
*/
|
302 |
+
function resolveTxt(hostname: string): Promise<string[][]>;
|
303 |
+
/**
|
304 |
+
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
305 |
+
* array of host names.
|
306 |
+
*
|
307 |
+
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code`
|
308 |
+
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
|
309 |
+
* @since v10.6.0
|
310 |
+
*/
|
311 |
+
function reverse(ip: string): Promise<string[]>;
|
312 |
+
/**
|
313 |
+
* Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
|
314 |
+
* The value could be:
|
315 |
+
*
|
316 |
+
* * `ipv4first`: for `verbatim` defaulting to `false`.
|
317 |
+
* * `verbatim`: for `verbatim` defaulting to `true`.
|
318 |
+
* @since v20.1.0
|
319 |
+
*/
|
320 |
+
function getDefaultResultOrder(): "ipv4first" | "verbatim";
|
321 |
+
/**
|
322 |
+
* Sets the IP address and port of servers to be used when performing DNS
|
323 |
+
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
324 |
+
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
325 |
+
*
|
326 |
+
* ```js
|
327 |
+
* dnsPromises.setServers([
|
328 |
+
* '4.4.4.4',
|
329 |
+
* '[2001:4860:4860::8888]',
|
330 |
+
* '4.4.4.4:1053',
|
331 |
+
* '[2001:4860:4860::8888]:1053',
|
332 |
+
* ]);
|
333 |
+
* ```
|
334 |
+
*
|
335 |
+
* An error will be thrown if an invalid address is provided.
|
336 |
+
*
|
337 |
+
* The `dnsPromises.setServers()` method must not be called while a DNS query is in
|
338 |
+
* progress.
|
339 |
+
*
|
340 |
+
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
341 |
+
* That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
342 |
+
* subsequent servers provided. Fallback DNS servers will only be used if the
|
343 |
+
* earlier ones time out or result in some other error.
|
344 |
+
* @since v10.6.0
|
345 |
+
* @param servers array of `RFC 5952` formatted addresses
|
346 |
+
*/
|
347 |
+
function setServers(servers: readonly string[]): void;
|
348 |
+
/**
|
349 |
+
* Set the default value of `order` in `dns.lookup()` and `{@link lookup}`. The value could be:
|
350 |
+
*
|
351 |
+
* * `ipv4first`: sets default `order` to `ipv4first`.
|
352 |
+
* * `ipv6first`: sets default `order` to `ipv6first`.
|
353 |
+
* * `verbatim`: sets default `order` to `verbatim`.
|
354 |
+
*
|
355 |
+
* The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
|
356 |
+
* have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
|
357 |
+
* When using [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
|
358 |
+
* from the main thread won't affect the default dns orders in workers.
|
359 |
+
* @since v16.4.0, v14.18.0
|
360 |
+
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
361 |
+
*/
|
362 |
+
function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
363 |
+
// Error codes
|
364 |
+
const NODATA: "ENODATA";
|
365 |
+
const FORMERR: "EFORMERR";
|
366 |
+
const SERVFAIL: "ESERVFAIL";
|
367 |
+
const NOTFOUND: "ENOTFOUND";
|
368 |
+
const NOTIMP: "ENOTIMP";
|
369 |
+
const REFUSED: "EREFUSED";
|
370 |
+
const BADQUERY: "EBADQUERY";
|
371 |
+
const BADNAME: "EBADNAME";
|
372 |
+
const BADFAMILY: "EBADFAMILY";
|
373 |
+
const BADRESP: "EBADRESP";
|
374 |
+
const CONNREFUSED: "ECONNREFUSED";
|
375 |
+
const TIMEOUT: "ETIMEOUT";
|
376 |
+
const EOF: "EOF";
|
377 |
+
const FILE: "EFILE";
|
378 |
+
const NOMEM: "ENOMEM";
|
379 |
+
const DESTRUCTION: "EDESTRUCTION";
|
380 |
+
const BADSTR: "EBADSTR";
|
381 |
+
const BADFLAGS: "EBADFLAGS";
|
382 |
+
const NONAME: "ENONAME";
|
383 |
+
const BADHINTS: "EBADHINTS";
|
384 |
+
const NOTINITIALIZED: "ENOTINITIALIZED";
|
385 |
+
const LOADIPHLPAPI: "ELOADIPHLPAPI";
|
386 |
+
const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
|
387 |
+
const CANCELLED: "ECANCELLED";
|
388 |
+
|
389 |
+
/**
|
390 |
+
* An independent resolver for DNS requests.
|
391 |
+
*
|
392 |
+
* Creating a new resolver uses the default server settings. Setting
|
393 |
+
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetserversservers) does not affect
|
394 |
+
* other resolvers:
|
395 |
+
*
|
396 |
+
* ```js
|
397 |
+
* const { Resolver } = require('node:dns').promises;
|
398 |
+
* const resolver = new Resolver();
|
399 |
+
* resolver.setServers(['4.4.4.4']);
|
400 |
+
*
|
401 |
+
* // This request will use the server at 4.4.4.4, independent of global settings.
|
402 |
+
* resolver.resolve4('example.org').then((addresses) => {
|
403 |
+
* // ...
|
404 |
+
* });
|
405 |
+
*
|
406 |
+
* // Alternatively, the same code can be written using async-await style.
|
407 |
+
* (async function() {
|
408 |
+
* const addresses = await resolver.resolve4('example.org');
|
409 |
+
* })();
|
410 |
+
* ```
|
411 |
+
*
|
412 |
+
* The following methods from the `dnsPromises` API are available:
|
413 |
+
*
|
414 |
+
* * `resolver.getServers()`
|
415 |
+
* * `resolver.resolve()`
|
416 |
+
* * `resolver.resolve4()`
|
417 |
+
* * `resolver.resolve6()`
|
418 |
+
* * `resolver.resolveAny()`
|
419 |
+
* * `resolver.resolveCaa()`
|
420 |
+
* * `resolver.resolveCname()`
|
421 |
+
* * `resolver.resolveMx()`
|
422 |
+
* * `resolver.resolveNaptr()`
|
423 |
+
* * `resolver.resolveNs()`
|
424 |
+
* * `resolver.resolvePtr()`
|
425 |
+
* * `resolver.resolveSoa()`
|
426 |
+
* * `resolver.resolveSrv()`
|
427 |
+
* * `resolver.resolveTxt()`
|
428 |
+
* * `resolver.reverse()`
|
429 |
+
* * `resolver.setServers()`
|
430 |
+
* @since v10.6.0
|
431 |
+
*/
|
432 |
+
class Resolver {
|
433 |
+
constructor(options?: ResolverOptions);
|
434 |
+
/**
|
435 |
+
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
436 |
+
* callbacks will be called with an error with code `ECANCELLED`.
|
437 |
+
* @since v8.3.0
|
438 |
+
*/
|
439 |
+
cancel(): void;
|
440 |
+
getServers: typeof getServers;
|
441 |
+
resolve: typeof resolve;
|
442 |
+
resolve4: typeof resolve4;
|
443 |
+
resolve6: typeof resolve6;
|
444 |
+
resolveAny: typeof resolveAny;
|
445 |
+
resolveCaa: typeof resolveCaa;
|
446 |
+
resolveCname: typeof resolveCname;
|
447 |
+
resolveMx: typeof resolveMx;
|
448 |
+
resolveNaptr: typeof resolveNaptr;
|
449 |
+
resolveNs: typeof resolveNs;
|
450 |
+
resolvePtr: typeof resolvePtr;
|
451 |
+
resolveSoa: typeof resolveSoa;
|
452 |
+
resolveSrv: typeof resolveSrv;
|
453 |
+
resolveTxt: typeof resolveTxt;
|
454 |
+
reverse: typeof reverse;
|
455 |
+
/**
|
456 |
+
* The resolver instance will send its requests from the specified IP address.
|
457 |
+
* This allows programs to specify outbound interfaces when used on multi-homed
|
458 |
+
* systems.
|
459 |
+
*
|
460 |
+
* If a v4 or v6 address is not specified, it is set to the default and the
|
461 |
+
* operating system will choose a local address automatically.
|
462 |
+
*
|
463 |
+
* The resolver will use the v4 local address when making requests to IPv4 DNS
|
464 |
+
* servers, and the v6 local address when making requests to IPv6 DNS servers.
|
465 |
+
* The `rrtype` of resolution requests has no impact on the local address used.
|
466 |
+
* @since v15.1.0, v14.17.0
|
467 |
+
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
468 |
+
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
469 |
+
*/
|
470 |
+
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
471 |
+
setServers: typeof setServers;
|
472 |
+
}
|
473 |
+
}
|
474 |
+
declare module "node:dns/promises" {
|
475 |
+
export * from "dns/promises";
|
476 |
+
}
|
workers1/auto3d/node_modules/@types/node/dom-events.d.ts
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export {}; // Don't export anything!
|
2 |
+
|
3 |
+
//// DOM-like Events
|
4 |
+
// NB: The Event / EventTarget / EventListener implementations below were copied
|
5 |
+
// from lib.dom.d.ts, then edited to reflect Node's documentation at
|
6 |
+
// https://nodejs.org/api/events.html#class-eventtarget.
|
7 |
+
// Please read that link to understand important implementation differences.
|
8 |
+
|
9 |
+
// This conditional type will be the existing global Event in a browser, or
|
10 |
+
// the copy below in a Node environment.
|
11 |
+
type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
|
12 |
+
: {
|
13 |
+
/** This is not used in Node.js and is provided purely for completeness. */
|
14 |
+
readonly bubbles: boolean;
|
15 |
+
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
|
16 |
+
cancelBubble: () => void;
|
17 |
+
/** True if the event was created with the cancelable option */
|
18 |
+
readonly cancelable: boolean;
|
19 |
+
/** This is not used in Node.js and is provided purely for completeness. */
|
20 |
+
readonly composed: boolean;
|
21 |
+
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
|
22 |
+
composedPath(): [EventTarget?];
|
23 |
+
/** Alias for event.target. */
|
24 |
+
readonly currentTarget: EventTarget | null;
|
25 |
+
/** Is true if cancelable is true and event.preventDefault() has been called. */
|
26 |
+
readonly defaultPrevented: boolean;
|
27 |
+
/** This is not used in Node.js and is provided purely for completeness. */
|
28 |
+
readonly eventPhase: 0 | 2;
|
29 |
+
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
|
30 |
+
readonly isTrusted: boolean;
|
31 |
+
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
|
32 |
+
preventDefault(): void;
|
33 |
+
/** This is not used in Node.js and is provided purely for completeness. */
|
34 |
+
returnValue: boolean;
|
35 |
+
/** Alias for event.target. */
|
36 |
+
readonly srcElement: EventTarget | null;
|
37 |
+
/** Stops the invocation of event listeners after the current one completes. */
|
38 |
+
stopImmediatePropagation(): void;
|
39 |
+
/** This is not used in Node.js and is provided purely for completeness. */
|
40 |
+
stopPropagation(): void;
|
41 |
+
/** The `EventTarget` dispatching the event */
|
42 |
+
readonly target: EventTarget | null;
|
43 |
+
/** The millisecond timestamp when the Event object was created. */
|
44 |
+
readonly timeStamp: number;
|
45 |
+
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
46 |
+
readonly type: string;
|
47 |
+
};
|
48 |
+
|
49 |
+
// See comment above explaining conditional type
|
50 |
+
type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
|
51 |
+
: {
|
52 |
+
/**
|
53 |
+
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
|
54 |
+
*
|
55 |
+
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
|
56 |
+
*
|
57 |
+
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
|
58 |
+
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
|
59 |
+
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
|
60 |
+
*/
|
61 |
+
addEventListener(
|
62 |
+
type: string,
|
63 |
+
listener: EventListener | EventListenerObject,
|
64 |
+
options?: AddEventListenerOptions | boolean,
|
65 |
+
): void;
|
66 |
+
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
|
67 |
+
dispatchEvent(event: Event): boolean;
|
68 |
+
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
|
69 |
+
removeEventListener(
|
70 |
+
type: string,
|
71 |
+
listener: EventListener | EventListenerObject,
|
72 |
+
options?: EventListenerOptions | boolean,
|
73 |
+
): void;
|
74 |
+
};
|
75 |
+
|
76 |
+
interface EventInit {
|
77 |
+
bubbles?: boolean;
|
78 |
+
cancelable?: boolean;
|
79 |
+
composed?: boolean;
|
80 |
+
}
|
81 |
+
|
82 |
+
interface EventListenerOptions {
|
83 |
+
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
|
84 |
+
capture?: boolean;
|
85 |
+
}
|
86 |
+
|
87 |
+
interface AddEventListenerOptions extends EventListenerOptions {
|
88 |
+
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
|
89 |
+
once?: boolean;
|
90 |
+
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
|
91 |
+
passive?: boolean;
|
92 |
+
/** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
|
93 |
+
signal?: AbortSignal;
|
94 |
+
}
|
95 |
+
|
96 |
+
interface EventListener {
|
97 |
+
(evt: Event): void;
|
98 |
+
}
|
99 |
+
|
100 |
+
interface EventListenerObject {
|
101 |
+
handleEvent(object: Event): void;
|
102 |
+
}
|
103 |
+
|
104 |
+
import {} from "events"; // Make this an ambient declaration
|
105 |
+
declare global {
|
106 |
+
/** An event which takes place in the DOM. */
|
107 |
+
interface Event extends __Event {}
|
108 |
+
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
|
109 |
+
: {
|
110 |
+
prototype: __Event;
|
111 |
+
new(type: string, eventInitDict?: EventInit): __Event;
|
112 |
+
};
|
113 |
+
|
114 |
+
/**
|
115 |
+
* EventTarget is a DOM interface implemented by objects that can
|
116 |
+
* receive events and may have listeners for them.
|
117 |
+
*/
|
118 |
+
interface EventTarget extends __EventTarget {}
|
119 |
+
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
120 |
+
: {
|
121 |
+
prototype: __EventTarget;
|
122 |
+
new(): __EventTarget;
|
123 |
+
};
|
124 |
+
}
|