typespeed 2.0.13 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.decorator.js +0 -1
- package/dist/database.decorator.js +0 -1
- package/dist/default/express-server.class.js +0 -1
- package/dist/default/log-default.class.js +0 -1
- package/dist/default/node-cache.class.js +0 -1
- package/dist/default/rabbitmq.class.js +0 -1
- package/dist/default/read-write-db.class.js +0 -1
- package/dist/default/redis.class.js +0 -1
- package/dist/factory/cache-factory.class.js +0 -1
- package/dist/factory/data-source-factory.class.js +0 -1
- package/dist/factory/log-factory.class.js +0 -1
- package/dist/factory/server-factory.class.js +0 -1
- package/dist/route.decorator.js +0 -1
- package/dist/scaffold/command.js +0 -1
- package/dist/typespeed.d.ts +133 -12
- package/dist/typespeed.js +1 -1
- package/package.json +2 -2
- package/src/typespeed.d.ts +133 -0
- package/src/typespeed.ts +2 -1
- package/test/node_modules/.package-lock.json +112 -4
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +17 -0
- package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +30 -0
- package/test/node_modules/@acuminous/bitsyntax/LICENSE +6 -0
- package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +21 -0
- package/test/node_modules/@acuminous/bitsyntax/Makefile +15 -0
- package/test/node_modules/@acuminous/bitsyntax/README.md +308 -0
- package/test/node_modules/@acuminous/bitsyntax/index.js +10 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +303 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +142 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +67 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +232 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +32 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +1173 -0
- package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +119 -0
- package/test/node_modules/@acuminous/bitsyntax/package.json +36 -0
- package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +50 -0
- package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +193 -0
- package/test/node_modules/@types/node/README.md +1 -1
- package/test/node_modules/@types/node/buffer.d.ts +5 -2
- package/test/node_modules/@types/node/child_process.d.ts +27 -0
- package/test/node_modules/@types/node/globals.d.ts +1 -0
- package/test/node_modules/@types/node/package.json +2 -2
- package/test/node_modules/@types/node/test.d.ts +43 -20
- package/test/node_modules/@types/node/ts4.8/buffer.d.ts +5 -2
- package/test/node_modules/@types/node/ts4.8/child_process.d.ts +27 -0
- package/test/node_modules/@types/node/ts4.8/globals.d.ts +1 -0
- package/test/node_modules/@types/node/ts4.8/test.d.ts +43 -19
- package/test/node_modules/@types/node/ts4.8/url.d.ts +3 -3
- package/test/node_modules/@types/node/ts4.8/util.d.ts +1 -1
- package/test/node_modules/@types/node/url.d.ts +3 -3
- package/test/node_modules/@types/node/util.d.ts +1 -1
- package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/test/node_modules/amqplib/.github/workflows/test.yml +38 -0
- package/test/node_modules/amqplib/CHANGELOG.md +430 -0
- package/test/node_modules/amqplib/LICENSE +6 -0
- package/test/node_modules/amqplib/LICENSE-MIT +21 -0
- package/test/node_modules/amqplib/Makefile +47 -0
- package/test/node_modules/amqplib/README.md +157 -0
- package/test/node_modules/amqplib/bin/generate-defs.js +722 -0
- package/test/node_modules/amqplib/callback_api.js +22 -0
- package/test/node_modules/amqplib/channel_api.js +16 -0
- package/test/node_modules/amqplib/examples/headers.js +42 -0
- package/test/node_modules/amqplib/examples/receive_generator.js +39 -0
- package/test/node_modules/amqplib/examples/send_generators.js +42 -0
- package/test/node_modules/amqplib/examples/ssl.js +64 -0
- package/test/node_modules/amqplib/examples/tutorials/README.md +93 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +28 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +30 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +27 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +27 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +30 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +36 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +56 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +55 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +49 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +45 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +29 -0
- package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +35 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log.js +19 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +20 -0
- package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +19 -0
- package/test/node_modules/amqplib/examples/tutorials/new_task.js +18 -0
- package/test/node_modules/amqplib/examples/tutorials/package.json +16 -0
- package/test/node_modules/amqplib/examples/tutorials/receive.js +21 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +28 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +44 -0
- package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +43 -0
- package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +52 -0
- package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +39 -0
- package/test/node_modules/amqplib/examples/tutorials/send.js +23 -0
- package/test/node_modules/amqplib/examples/tutorials/worker.js +28 -0
- package/test/node_modules/amqplib/examples/waitForConfirms.js +22 -0
- package/test/node_modules/amqplib/lib/api_args.js +314 -0
- package/test/node_modules/amqplib/lib/bitset.js +130 -0
- package/test/node_modules/amqplib/lib/callback_model.js +327 -0
- package/test/node_modules/amqplib/lib/channel.js +499 -0
- package/test/node_modules/amqplib/lib/channel_model.js +302 -0
- package/test/node_modules/amqplib/lib/codec.js +321 -0
- package/test/node_modules/amqplib/lib/connect.js +189 -0
- package/test/node_modules/amqplib/lib/connection.js +663 -0
- package/test/node_modules/amqplib/lib/credentials.js +42 -0
- package/test/node_modules/amqplib/lib/defs.js +4966 -0
- package/test/node_modules/amqplib/lib/error.js +24 -0
- package/test/node_modules/amqplib/lib/format.js +40 -0
- package/test/node_modules/amqplib/lib/frame.js +113 -0
- package/test/node_modules/amqplib/lib/heartbeat.js +89 -0
- package/test/node_modules/amqplib/lib/mux.js +129 -0
- package/test/node_modules/amqplib/package.json +37 -0
- package/test/node_modules/amqplib/test/bitset.js +69 -0
- package/test/node_modules/amqplib/test/callback_api.js +312 -0
- package/test/node_modules/amqplib/test/channel.js +621 -0
- package/test/node_modules/amqplib/test/channel_api.js +596 -0
- package/test/node_modules/amqplib/test/codec.js +237 -0
- package/test/node_modules/amqplib/test/connect.js +197 -0
- package/test/node_modules/amqplib/test/connection.js +390 -0
- package/test/node_modules/amqplib/test/data.js +254 -0
- package/test/node_modules/amqplib/test/frame.js +198 -0
- package/test/node_modules/amqplib/test/mux.js +204 -0
- package/test/node_modules/amqplib/test/util.js +219 -0
- package/test/node_modules/buffer-more-ints/.travis.yml +6 -0
- package/test/node_modules/buffer-more-ints/LICENSE +19 -0
- package/test/node_modules/buffer-more-ints/README.md +69 -0
- package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +183 -0
- package/test/node_modules/buffer-more-ints/buffer-more-ints.js +432 -0
- package/test/node_modules/buffer-more-ints/package.json +19 -0
- package/test/node_modules/buffer-more-ints/polyfill.js +71 -0
- package/test/node_modules/core-util-is/LICENSE +19 -0
- package/test/node_modules/core-util-is/README.md +3 -0
- package/test/node_modules/core-util-is/lib/util.js +107 -0
- package/test/node_modules/core-util-is/package.json +38 -0
- package/test/node_modules/debug/LICENSE +20 -0
- package/test/node_modules/debug/README.md +481 -0
- package/test/node_modules/debug/package.json +59 -0
- package/test/node_modules/debug/src/browser.js +269 -0
- package/test/node_modules/debug/src/common.js +274 -0
- package/test/node_modules/debug/src/index.js +10 -0
- package/test/node_modules/debug/src/node.js +263 -0
- package/test/node_modules/inherits/LICENSE +16 -0
- package/test/node_modules/inherits/README.md +42 -0
- package/test/node_modules/inherits/inherits.js +9 -0
- package/test/node_modules/inherits/inherits_browser.js +27 -0
- package/test/node_modules/inherits/package.json +29 -0
- package/test/node_modules/isarray/README.md +54 -0
- package/test/node_modules/isarray/build/build.js +209 -0
- package/test/node_modules/isarray/component.json +19 -0
- package/test/node_modules/isarray/index.js +3 -0
- package/test/node_modules/isarray/package.json +25 -0
- package/test/node_modules/ms/index.js +162 -0
- package/test/node_modules/ms/license.md +21 -0
- package/test/node_modules/ms/package.json +37 -0
- package/test/node_modules/ms/readme.md +60 -0
- package/test/node_modules/querystringify/LICENSE +22 -0
- package/test/node_modules/querystringify/README.md +61 -0
- package/test/node_modules/querystringify/index.js +118 -0
- package/test/node_modules/querystringify/package.json +38 -0
- package/test/node_modules/readable-stream/LICENSE +18 -0
- package/test/node_modules/readable-stream/README.md +15 -0
- package/test/node_modules/readable-stream/duplex.js +1 -0
- package/test/node_modules/readable-stream/float.patch +923 -0
- package/test/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
- package/test/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
- package/test/node_modules/readable-stream/lib/_stream_readable.js +951 -0
- package/test/node_modules/readable-stream/lib/_stream_transform.js +209 -0
- package/test/node_modules/readable-stream/lib/_stream_writable.js +477 -0
- package/test/node_modules/readable-stream/package.json +32 -0
- package/test/node_modules/readable-stream/passthrough.js +1 -0
- package/test/node_modules/readable-stream/readable.js +10 -0
- package/test/node_modules/readable-stream/transform.js +1 -0
- package/test/node_modules/readable-stream/writable.js +1 -0
- package/test/node_modules/requires-port/.travis.yml +19 -0
- package/test/node_modules/requires-port/LICENSE +22 -0
- package/test/node_modules/requires-port/README.md +47 -0
- package/test/node_modules/requires-port/index.js +38 -0
- package/test/node_modules/requires-port/package.json +47 -0
- package/test/node_modules/requires-port/test.js +98 -0
- package/test/node_modules/safe-buffer/LICENSE +21 -0
- package/test/node_modules/safe-buffer/README.md +584 -0
- package/test/node_modules/safe-buffer/index.d.ts +187 -0
- package/test/node_modules/safe-buffer/index.js +62 -0
- package/test/node_modules/safe-buffer/package.json +37 -0
- package/test/node_modules/string_decoder/LICENSE +20 -0
- package/test/node_modules/string_decoder/README.md +7 -0
- package/test/node_modules/string_decoder/index.js +221 -0
- package/test/node_modules/string_decoder/package.json +25 -0
- package/test/node_modules/url-parse/LICENSE +22 -0
- package/test/node_modules/url-parse/README.md +153 -0
- package/test/node_modules/url-parse/dist/url-parse.js +755 -0
- package/test/node_modules/url-parse/dist/url-parse.min.js +1 -0
- package/test/node_modules/url-parse/dist/url-parse.min.js.map +1 -0
- package/test/node_modules/url-parse/index.js +589 -0
- package/test/node_modules/url-parse/package.json +49 -0
- package/test/src/test-mq.class.ts +1 -2
- package/tsconfig.json +4 -3
- package/dist/core.decorator.d.ts +0 -18
- package/dist/core.decorator.js.map +0 -1
- package/dist/database.decorator.d.ts +0 -24
- package/dist/database.decorator.js.map +0 -1
- package/dist/default/express-server.class.d.ts +0 -15
- package/dist/default/express-server.class.js.map +0 -1
- package/dist/default/log-default.class.d.ts +0 -6
- package/dist/default/log-default.class.js.map +0 -1
- package/dist/default/node-cache.class.d.ts +0 -13
- package/dist/default/node-cache.class.js.map +0 -1
- package/dist/default/rabbitmq.class.d.ts +0 -9
- package/dist/default/rabbitmq.class.js.map +0 -1
- package/dist/default/read-write-db.class.d.ts +0 -10
- package/dist/default/read-write-db.class.js.map +0 -1
- package/dist/default/redis.class.d.ts +0 -5
- package/dist/default/redis.class.js.map +0 -1
- package/dist/factory/cache-factory.class.d.ts +0 -7
- package/dist/factory/cache-factory.class.js.map +0 -1
- package/dist/factory/data-source-factory.class.d.ts +0 -4
- package/dist/factory/data-source-factory.class.js.map +0 -1
- package/dist/factory/log-factory.class.d.ts +0 -4
- package/dist/factory/log-factory.class.js.map +0 -1
- package/dist/factory/server-factory.class.d.ts +0 -6
- package/dist/factory/server-factory.class.js.map +0 -1
- package/dist/route.decorator.d.ts +0 -8
- package/dist/route.decorator.js.map +0 -1
- package/dist/scaffold/command.d.ts +0 -2
- package/dist/scaffold/command.js.map +0 -1
- package/dist/typespeed.js.map +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// -*- js-indent-level: 2 -*-
|
|
2
|
+
// Constructing patterns
|
|
3
|
+
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
function set(values) {
|
|
7
|
+
var s = {};
|
|
8
|
+
for (var i in values) {
|
|
9
|
+
if (!Object.prototype.hasOwnProperty.call(values, i)) continue;
|
|
10
|
+
s[values[i]] = 1;
|
|
11
|
+
}
|
|
12
|
+
return s;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Construct a segment bound to a variable, e.g., from a segment like
|
|
16
|
+
// "Len:32/unsigned-big". `specifiers0` is an array.
|
|
17
|
+
function variable(name, size, specifiers0) {
|
|
18
|
+
var specifiers = set(specifiers0);
|
|
19
|
+
var segment = {name: name};
|
|
20
|
+
segment.type = type_in(specifiers);
|
|
21
|
+
specs(segment, segment.type, specifiers);
|
|
22
|
+
segment.size = size_of(segment, segment.type, size, segment.unit);
|
|
23
|
+
return segment;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports.variable = variable;
|
|
27
|
+
module.exports.rest = function() {
|
|
28
|
+
return variable('_', true, ['binary']);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Construct a segment with a literal value, e.g., from a segment like
|
|
32
|
+
// "206". `specifiers0` is an array.
|
|
33
|
+
|
|
34
|
+
function value(val, size, specifiers0) {
|
|
35
|
+
var specifiers = set(specifiers0);
|
|
36
|
+
var segment = {value: val};
|
|
37
|
+
segment.type = type_in(specifiers);
|
|
38
|
+
// TODO check type v. value ..
|
|
39
|
+
specs(segment, segment.type, specifiers);
|
|
40
|
+
segment.size = size_of(segment, segment.type, size, segment.unit);
|
|
41
|
+
return segment;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports.value = value;
|
|
45
|
+
|
|
46
|
+
// A string can appear as a literal, but it must appear without
|
|
47
|
+
// specifiers.
|
|
48
|
+
function string(val) {
|
|
49
|
+
return {value: val, type: 'string'};
|
|
50
|
+
}
|
|
51
|
+
module.exports.string = string;
|
|
52
|
+
|
|
53
|
+
var TYPES = {'integer': 1, 'binary': 1, 'float': 1};
|
|
54
|
+
function type_in(specifiers) {
|
|
55
|
+
for (var t in specifiers) {
|
|
56
|
+
if (!Object.prototype.hasOwnProperty.call(specifiers, t)) continue;
|
|
57
|
+
if (TYPES[t]) { return t; }
|
|
58
|
+
}
|
|
59
|
+
return 'integer';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function specs(segment, type, specifiers) {
|
|
63
|
+
switch (type) {
|
|
64
|
+
case 'integer':
|
|
65
|
+
segment.signed = signed_in(specifiers);
|
|
66
|
+
// fall through
|
|
67
|
+
case 'float':
|
|
68
|
+
segment.bigendian = endian_in(specifiers);
|
|
69
|
+
// fall through
|
|
70
|
+
default:
|
|
71
|
+
segment.unit = unit_in(specifiers, segment.type);
|
|
72
|
+
}
|
|
73
|
+
return segment;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function endian_in(specifiers) {
|
|
77
|
+
// default is big, but I have chosen true = bigendian
|
|
78
|
+
return !specifiers['little'];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function signed_in(specifiers) {
|
|
82
|
+
// this time I got it right; default is unsigned
|
|
83
|
+
return specifiers['signed'];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function unit_in(specifiers, type) {
|
|
87
|
+
for (var s in specifiers) {
|
|
88
|
+
if (!Object.prototype.hasOwnProperty.call(specifiers, s)) continue;
|
|
89
|
+
if (s.substr(0, 5) == 'unit:') {
|
|
90
|
+
var unit = parseInt(s.substr(5));
|
|
91
|
+
// TODO check sane for type
|
|
92
|
+
return unit;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// OK defaults then
|
|
96
|
+
switch (type) {
|
|
97
|
+
case 'binary':
|
|
98
|
+
return 8;
|
|
99
|
+
case 'integer':
|
|
100
|
+
case 'float':
|
|
101
|
+
return 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function size_of(segment, type, size, unit) {
|
|
106
|
+
if (size !== undefined && size !== '') {
|
|
107
|
+
return size;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
switch (type) {
|
|
111
|
+
case 'integer':
|
|
112
|
+
return 8;
|
|
113
|
+
case 'float':
|
|
114
|
+
return 64;
|
|
115
|
+
case 'binary':
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Michael Bridgen <mikeb@squaremobius.net>",
|
|
3
|
+
"name": "@acuminous/bitsyntax",
|
|
4
|
+
"description": "Pattern-matching on byte buffers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"version": "0.1.2",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git://github.com/acuminous/bitsyntax-js.git"
|
|
10
|
+
},
|
|
11
|
+
"main": "./index",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "make test",
|
|
14
|
+
"prepublish": "make all"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=0.8"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"buffer-more-ints": "~1.0.0",
|
|
21
|
+
"debug": "^4.3.4",
|
|
22
|
+
"safe-buffer": "~5.1.2"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"pegjs": "^0.7.0",
|
|
26
|
+
"zunit": "^3.2.1"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/acuminous/bitsyntax-js/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/acuminous/bitsyntax-js#readme",
|
|
32
|
+
"directories": {
|
|
33
|
+
"lib": "lib",
|
|
34
|
+
"test": "test"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var syntax = require('zunit').syntax;
|
|
2
|
+
var assert = require('assert');
|
|
3
|
+
var parse = require('..').parse;
|
|
4
|
+
var build = require('..').build;
|
|
5
|
+
var builder = require('..').builder;
|
|
6
|
+
var write = require('..').write;
|
|
7
|
+
|
|
8
|
+
var Buffer = require('safe-buffer').Buffer;
|
|
9
|
+
var suite = syntax.describe;
|
|
10
|
+
var test = syntax.it;
|
|
11
|
+
|
|
12
|
+
TEST_CASES = [
|
|
13
|
+
['n:8', {n:255}, [255]],
|
|
14
|
+
['n:16', {n: 0xf0f0}, [240, 240]],
|
|
15
|
+
['n:32', {n: 0x12345678}, [18,52,86,120]],
|
|
16
|
+
['n:64', {n: 0xffffffffffffffff}, [255,255,255,255,255,255,255,255]],
|
|
17
|
+
|
|
18
|
+
['n:8, s/binary', {n: 255, s: Buffer.from("foobar")}, [255, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]],
|
|
19
|
+
['n:8, "foobar", m:8', {n: 255, m:0}, [255, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0]],
|
|
20
|
+
['n:8, s:n/binary', {n:6, s: Buffer.from('foobar')}, [6, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72]],
|
|
21
|
+
['n:8, s:n/binary', {n:4, s: Buffer.from('foobar')}, [4, 0x66, 0x6f, 0x6f, 0x62]],
|
|
22
|
+
['n:size', {n:4, size:8}, [4]],
|
|
23
|
+
['206:n/unit:8', {n:1}, [206]]
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
function bufferToArray(buf) {
|
|
27
|
+
return Array.prototype.slice.call(buf);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
suite("Construction", function() {
|
|
31
|
+
TEST_CASES.forEach(function(c) {
|
|
32
|
+
var p = parse(c[0]);
|
|
33
|
+
test(c[0], function() {
|
|
34
|
+
assert.deepEqual(c[2], bufferToArray(build(p, c[1])));
|
|
35
|
+
});
|
|
36
|
+
test(c[0], function() {
|
|
37
|
+
var buf = Buffer.alloc(1024);
|
|
38
|
+
var end = write(buf, 7, p, c[1]);
|
|
39
|
+
buf = buf.slice(7, end);
|
|
40
|
+
assert.deepEqual(c[2], bufferToArray(buf));
|
|
41
|
+
});
|
|
42
|
+
test(c[0], function() {
|
|
43
|
+
var cons = builder(c[0]);
|
|
44
|
+
var buf = cons(c[1]);
|
|
45
|
+
assert.deepEqual(c[2], bufferToArray(buf));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
});
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var syntax = require('zunit').syntax;
|
|
2
|
+
var match = require('..').match;
|
|
3
|
+
var parse = require('..').parse;
|
|
4
|
+
var compile = require('..').matcher;
|
|
5
|
+
var assert = require('assert');
|
|
6
|
+
|
|
7
|
+
var Buffer = require('safe-buffer').Buffer;
|
|
8
|
+
var suite = syntax.describe;
|
|
9
|
+
var test = syntax.it;
|
|
10
|
+
|
|
11
|
+
Object.prototype.AMQPLIB_ISSUE_453 = 123123123
|
|
12
|
+
|
|
13
|
+
var INT_TESTS = [
|
|
14
|
+
['n:8',
|
|
15
|
+
[[[255], 255]]],
|
|
16
|
+
['n:8/signed',
|
|
17
|
+
[[[255], -1]]],
|
|
18
|
+
['n:1/unit:8',
|
|
19
|
+
[[[129], 129]]],
|
|
20
|
+
['n:1/unit:8-signed',
|
|
21
|
+
[[[129], -127]]],
|
|
22
|
+
|
|
23
|
+
['n:16',
|
|
24
|
+
[[[1, 255], 511]]],
|
|
25
|
+
['n:16/signed',
|
|
26
|
+
[[[255, 65], -191]]],
|
|
27
|
+
['n:16/little',
|
|
28
|
+
[[[255, 1], 511]]],
|
|
29
|
+
['n:16/signed-little',
|
|
30
|
+
[[[65, 255], -191]]],
|
|
31
|
+
|
|
32
|
+
['n:32',
|
|
33
|
+
[[[45, 23, 97, 102], 756506982]]],
|
|
34
|
+
['n:32/signed',
|
|
35
|
+
[[[245, 23, 97, 102], -183017114]]],
|
|
36
|
+
['n:32/little',
|
|
37
|
+
[[[245, 23, 97, 102], 1717639157]]],
|
|
38
|
+
['n:32/signed-little',
|
|
39
|
+
[[[245, 23, 97, 129], -2124343307]]],
|
|
40
|
+
|
|
41
|
+
['n:4/signed-little-unit:8',
|
|
42
|
+
[[[245, 23, 97, 129], -2124343307]]],
|
|
43
|
+
|
|
44
|
+
['n:64',
|
|
45
|
+
[[[1,2,3,4,5,6,7,8], 72623859790382856]]],
|
|
46
|
+
['n:64/signed',
|
|
47
|
+
[[[255,2,3,4,5,6,7,8], -71491328285473016]]],
|
|
48
|
+
['n:64/little',
|
|
49
|
+
[[[1,2,3,4,5,6,7,8], 578437695752307201]]],
|
|
50
|
+
['n:64/little-signed',
|
|
51
|
+
[[[1,2,3,4,5,6,7,255], -70080650589044223]]],
|
|
52
|
+
['n:8/signed-unit:8-little',
|
|
53
|
+
[[[1,2,3,4,5,6,7,255], -70080650589044223]]],
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
suite("Integer",
|
|
57
|
+
function() {
|
|
58
|
+
|
|
59
|
+
INT_TESTS.forEach(function(p) {
|
|
60
|
+
var pattern = parse(p[0]);
|
|
61
|
+
var cpattern = compile(p[0]);
|
|
62
|
+
p[1].forEach(function(tc) {
|
|
63
|
+
test(p[0], function() {
|
|
64
|
+
assert.deepEqual({n: tc[1]}, match(pattern, Buffer.from(tc[0])));
|
|
65
|
+
});
|
|
66
|
+
test(p[0], function() {
|
|
67
|
+
assert.deepEqual({n: tc[1]}, cpattern(Buffer.from(tc[0])));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// test cases largely constructed in Erlang using e.g.,
|
|
75
|
+
// Pi = math:pi(), <<Pi:32/float>>.
|
|
76
|
+
FLOAT_TESTS = [
|
|
77
|
+
['n:32/float',
|
|
78
|
+
[[[64,73,15,219], Math.PI],
|
|
79
|
+
[[0, 0, 0, 0], 0.0 ]]],
|
|
80
|
+
|
|
81
|
+
['n:64/float',
|
|
82
|
+
[[[64,9,33,251,84,68,45,24], Math.PI],
|
|
83
|
+
[[0, 0, 0, 0, 0, 0, 0, 0], 0.0]]],
|
|
84
|
+
|
|
85
|
+
['n:32/float-little',
|
|
86
|
+
[[[219, 15, 73, 64], Math.PI],
|
|
87
|
+
[[0, 0, 0, 0], 0.0]]],
|
|
88
|
+
|
|
89
|
+
['n:64/float-little',
|
|
90
|
+
[[[24, 45, 68, 84, 251, 33, 9, 64], Math.PI],
|
|
91
|
+
[[0, 0, 0, 0, 0, 0, 0, 0], 0.0]]],
|
|
92
|
+
|
|
93
|
+
['n:4/float-unit:8',
|
|
94
|
+
[[[64,73,15,219], Math.PI],
|
|
95
|
+
[[0, 0, 0, 0], 0.0]]]
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
suite("Float",
|
|
99
|
+
function() {
|
|
100
|
+
var precision = 0.00001;
|
|
101
|
+
FLOAT_TESTS.forEach(function(p) {
|
|
102
|
+
var pattern = parse(p[0]);
|
|
103
|
+
var cpattern = compile(p[0]);
|
|
104
|
+
p[1].forEach(function(tc) {
|
|
105
|
+
test(p[0], function() {
|
|
106
|
+
var m = match(pattern, Buffer.from(tc[0]));
|
|
107
|
+
assert.ok(m.n !== undefined);
|
|
108
|
+
assert.ok(Math.abs(tc[1] - m.n) < precision);
|
|
109
|
+
});
|
|
110
|
+
test(p[0], function() {
|
|
111
|
+
var m = cpattern(Buffer.from(tc[0]));
|
|
112
|
+
assert.ok(m.n !== undefined);
|
|
113
|
+
assert.ok(Math.abs(tc[1] - m.n) < precision);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
BINARY_TESTS = [
|
|
120
|
+
['n:0/unit:8-binary', []],
|
|
121
|
+
['n:1/unit:8-binary', [93]],
|
|
122
|
+
['n:5/unit:8-binary', [1, 2, 3, 4, 5]],
|
|
123
|
+
['n:32/unit:1-binary', [255, 254, 253, 252]]
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
suite("Binary",
|
|
127
|
+
function() {
|
|
128
|
+
BINARY_TESTS.forEach(function(p) {
|
|
129
|
+
var pattern = parse(p[0]);
|
|
130
|
+
var cpattern = compile(p[0]);
|
|
131
|
+
var prest = p[0] + ', _/binary';
|
|
132
|
+
var patternrest = parse(prest);
|
|
133
|
+
var cpatternrest = compile(prest);
|
|
134
|
+
test(p[0], function() {
|
|
135
|
+
assert.deepEqual({n: Buffer.from(p[1])},
|
|
136
|
+
match(pattern, Buffer.from(p[1])));
|
|
137
|
+
assert.deepEqual({n: Buffer.from(p[1])},
|
|
138
|
+
cpattern(Buffer.from(p[1])));
|
|
139
|
+
});
|
|
140
|
+
test(prest, function() {
|
|
141
|
+
var plusgarbage = p[1].concat([5, 98, 23, 244]);
|
|
142
|
+
assert.deepEqual({n: Buffer.from(p[1])},
|
|
143
|
+
match(patternrest, Buffer.from(plusgarbage)));
|
|
144
|
+
assert.deepEqual({n: Buffer.from(p[1])},
|
|
145
|
+
cpatternrest(Buffer.from(plusgarbage)));
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
var VAR_TESTS = [
|
|
151
|
+
['size, n:size',
|
|
152
|
+
[[[8, 5], 5],
|
|
153
|
+
[[32, 0, 0, 0, 167], 167]]],
|
|
154
|
+
|
|
155
|
+
['size, n:size/binary',
|
|
156
|
+
[[[2, 5, 6], Buffer.from([5, 6])]]],
|
|
157
|
+
|
|
158
|
+
['a, b:a, n:b',
|
|
159
|
+
[[[8, 32, 0, 0, 2, 100], 612]]]
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
suite("Environment",
|
|
163
|
+
function() {
|
|
164
|
+
VAR_TESTS.forEach(function(p) {
|
|
165
|
+
var pattern = parse(p[0]);
|
|
166
|
+
var cpattern = compile(p[0]);
|
|
167
|
+
p[1].forEach(function(tc) {
|
|
168
|
+
test(p[0], function() {
|
|
169
|
+
assert.deepEqual(tc[1], match(pattern, Buffer.from(tc[0])).n);
|
|
170
|
+
});
|
|
171
|
+
test(p[0], function() {
|
|
172
|
+
assert.deepEqual(tc[1], cpattern(Buffer.from(tc[0])).n);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
STRING_TESTS = [
|
|
179
|
+
['"foobar", n:8', "foobarA", 'A'.charCodeAt(0)],
|
|
180
|
+
['n:8, "foobar", _/binary', "CfoobarGARBAGE", 'C'.charCodeAt(0)],
|
|
181
|
+
['"foo, :-bar\\"", n:8, "another"', 'foo, :-bar"Zanother', 'Z'.charCodeAt(0)]
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
suite("String",
|
|
185
|
+
function() {
|
|
186
|
+
STRING_TESTS.forEach(function(p) {
|
|
187
|
+
var pattern = parse(p[0]);
|
|
188
|
+
test(p[0], function() {
|
|
189
|
+
var res = match(pattern, Buffer.from(p[1]));
|
|
190
|
+
assert.equal(res.n, p[2]);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sun, 21 May 2023 21:02:54 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -202,6 +202,9 @@ declare module 'buffer' {
|
|
|
202
202
|
// the copy below in a Node environment.
|
|
203
203
|
type __Blob = typeof globalThis extends { onmessage: any; Blob: infer T } ? T : NodeBlob;
|
|
204
204
|
global {
|
|
205
|
+
namespace NodeJS {
|
|
206
|
+
export { BufferEncoding };
|
|
207
|
+
}
|
|
205
208
|
// Buffer class
|
|
206
209
|
type BufferEncoding =
|
|
207
210
|
| 'ascii'
|
|
@@ -2280,7 +2283,7 @@ declare module 'buffer' {
|
|
|
2280
2283
|
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
|
2281
2284
|
* **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
|
|
2282
2285
|
* @since v15.13.0, v14.17.0
|
|
2283
|
-
* @
|
|
2286
|
+
* @legacy Use `Buffer.from(data, 'base64')` instead.
|
|
2284
2287
|
* @param data The Base64-encoded input string.
|
|
2285
2288
|
*/
|
|
2286
2289
|
function atob(data: string): string;
|
|
@@ -2296,7 +2299,7 @@ declare module 'buffer' {
|
|
|
2296
2299
|
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
|
2297
2300
|
* **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
|
|
2298
2301
|
* @since v15.13.0, v14.17.0
|
|
2299
|
-
* @
|
|
2302
|
+
* @legacy Use `buf.toString('base64')` instead.
|
|
2300
2303
|
* @param data An ASCII (Latin1) string.
|
|
2301
2304
|
*/
|
|
2302
2305
|
function btoa(data: string): string;
|
|
@@ -634,6 +634,15 @@ declare module 'child_process' {
|
|
|
634
634
|
}
|
|
635
635
|
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
|
636
636
|
argv0?: string | undefined;
|
|
637
|
+
/**
|
|
638
|
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
|
639
|
+
* If passed as an array, the first element is used for `stdin`, the second for
|
|
640
|
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
641
|
+
* specify the `stdio` behavior beyond the standard streams. See
|
|
642
|
+
* {@link ChildProcess.stdio} for more information.
|
|
643
|
+
*
|
|
644
|
+
* @default 'pipe'
|
|
645
|
+
*/
|
|
637
646
|
stdio?: StdioOptions | undefined;
|
|
638
647
|
shell?: boolean | string | undefined;
|
|
639
648
|
windowsVerbatimArguments?: boolean | undefined;
|
|
@@ -1195,6 +1204,15 @@ declare module 'child_process' {
|
|
|
1195
1204
|
execPath?: string | undefined;
|
|
1196
1205
|
execArgv?: string[] | undefined;
|
|
1197
1206
|
silent?: boolean | undefined;
|
|
1207
|
+
/**
|
|
1208
|
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
|
1209
|
+
* If passed as an array, the first element is used for `stdin`, the second for
|
|
1210
|
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
1211
|
+
* specify the `stdio` behavior beyond the standard streams. See
|
|
1212
|
+
* {@link ChildProcess.stdio} for more information.
|
|
1213
|
+
*
|
|
1214
|
+
* @default 'pipe'
|
|
1215
|
+
*/
|
|
1198
1216
|
stdio?: StdioOptions | undefined;
|
|
1199
1217
|
detached?: boolean | undefined;
|
|
1200
1218
|
windowsVerbatimArguments?: boolean | undefined;
|
|
@@ -1295,6 +1313,15 @@ declare module 'child_process' {
|
|
|
1295
1313
|
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
|
1296
1314
|
interface CommonExecOptions extends CommonOptions {
|
|
1297
1315
|
input?: string | NodeJS.ArrayBufferView | undefined;
|
|
1316
|
+
/**
|
|
1317
|
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
|
1318
|
+
* If passed as an array, the first element is used for `stdin`, the second for
|
|
1319
|
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
|
1320
|
+
* specify the `stdio` behavior beyond the standard streams. See
|
|
1321
|
+
* {@link ChildProcess.stdio} for more information.
|
|
1322
|
+
*
|
|
1323
|
+
* @default 'pipe'
|
|
1324
|
+
*/
|
|
1298
1325
|
stdio?: StdioOptions | undefined;
|
|
1299
1326
|
killSignal?: NodeJS.Signals | number | undefined;
|
|
1300
1327
|
maxBuffer?: number | undefined;
|
|
@@ -64,6 +64,7 @@ interface AbortSignal extends EventTarget {
|
|
|
64
64
|
readonly aborted: boolean;
|
|
65
65
|
readonly reason: any;
|
|
66
66
|
onabort: null | ((this: AbortSignal, event: Event) => any);
|
|
67
|
+
throwIfAborted(): void;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
declare var AbortController: typeof globalThis extends {onmessage: any; AbortController: infer T}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.16.
|
|
3
|
+
"version": "18.16.14",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -232,6 +232,6 @@
|
|
|
232
232
|
},
|
|
233
233
|
"scripts": {},
|
|
234
234
|
"dependencies": {},
|
|
235
|
-
"typesPublisherContentHash": "
|
|
235
|
+
"typesPublisherContentHash": "1ddc18d0b32383ce71e84dee2d8cf940cfad390444fd7248f2435c57f7d2c2b4",
|
|
236
236
|
"typeScriptVersion": "4.3"
|
|
237
237
|
}
|
|
@@ -10,7 +10,6 @@ declare module 'node:test' {
|
|
|
10
10
|
* @returns A {@link TestsStream} that emits events about the test execution.
|
|
11
11
|
*/
|
|
12
12
|
function run(options?: RunOptions): TestsStream;
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* The `test()` function is the value imported from the test module. Each invocation of this
|
|
16
15
|
* function results in reporting the test to the {@link TestsStream}.
|
|
@@ -49,7 +48,19 @@ declare module 'node:test' {
|
|
|
49
48
|
function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
50
49
|
function test(options?: TestOptions, fn?: TestFn): Promise<void>;
|
|
51
50
|
function test(fn?: TestFn): Promise<void>;
|
|
52
|
-
|
|
51
|
+
namespace test {
|
|
52
|
+
export {
|
|
53
|
+
after,
|
|
54
|
+
afterEach,
|
|
55
|
+
before,
|
|
56
|
+
beforeEach,
|
|
57
|
+
describe,
|
|
58
|
+
it,
|
|
59
|
+
run,
|
|
60
|
+
mock,
|
|
61
|
+
test
|
|
62
|
+
};
|
|
63
|
+
}
|
|
53
64
|
/**
|
|
54
65
|
* @since v18.6.0
|
|
55
66
|
* @param name The name of the suite, which is displayed when reporting suite results.
|
|
@@ -73,6 +84,15 @@ declare module 'node:test' {
|
|
|
73
84
|
function todo(name?: string, fn?: SuiteFn): void;
|
|
74
85
|
function todo(options?: TestOptions, fn?: SuiteFn): void;
|
|
75
86
|
function todo(fn?: SuiteFn): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
|
|
90
|
+
* @since v18.15.0
|
|
91
|
+
*/
|
|
92
|
+
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void;
|
|
93
|
+
function only(name?: string, fn?: SuiteFn): void;
|
|
94
|
+
function only(options?: TestOptions, fn?: SuiteFn): void;
|
|
95
|
+
function only(fn?: SuiteFn): void;
|
|
76
96
|
}
|
|
77
97
|
|
|
78
98
|
/**
|
|
@@ -83,22 +103,31 @@ declare module 'node:test' {
|
|
|
83
103
|
* @param fn The function under test. If the test uses callbacks, the callback function is
|
|
84
104
|
* passed as the second argument. Default: A no-op function.
|
|
85
105
|
*/
|
|
86
|
-
function it(name?: string, options?: TestOptions, fn?:
|
|
87
|
-
function it(name?: string, fn?:
|
|
88
|
-
function it(options?: TestOptions, fn?:
|
|
89
|
-
function it(fn?:
|
|
106
|
+
function it(name?: string, options?: TestOptions, fn?: TestFn): void;
|
|
107
|
+
function it(name?: string, fn?: TestFn): void;
|
|
108
|
+
function it(options?: TestOptions, fn?: TestFn): void;
|
|
109
|
+
function it(fn?: TestFn): void;
|
|
90
110
|
namespace it {
|
|
91
111
|
// Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
|
|
92
|
-
function skip(name?: string, options?: TestOptions, fn?:
|
|
93
|
-
function skip(name?: string, fn?:
|
|
94
|
-
function skip(options?: TestOptions, fn?:
|
|
95
|
-
function skip(fn?:
|
|
112
|
+
function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
|
|
113
|
+
function skip(name?: string, fn?: TestFn): void;
|
|
114
|
+
function skip(options?: TestOptions, fn?: TestFn): void;
|
|
115
|
+
function skip(fn?: TestFn): void;
|
|
96
116
|
|
|
97
117
|
// Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
|
|
98
|
-
function todo(name?: string, options?: TestOptions, fn?:
|
|
99
|
-
function todo(name?: string, fn?:
|
|
100
|
-
function todo(options?: TestOptions, fn?:
|
|
101
|
-
function todo(fn?:
|
|
118
|
+
function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
|
|
119
|
+
function todo(name?: string, fn?: TestFn): void;
|
|
120
|
+
function todo(options?: TestOptions, fn?: TestFn): void;
|
|
121
|
+
function todo(fn?: TestFn): void;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
|
|
125
|
+
* @since v18.15.0
|
|
126
|
+
*/
|
|
127
|
+
function only(name?: string, options?: TestOptions, fn?: TestFn): void;
|
|
128
|
+
function only(name?: string, fn?: TestFn): void;
|
|
129
|
+
function only(options?: TestOptions, fn?: TestFn): void;
|
|
130
|
+
function only(fn?: TestFn): void;
|
|
102
131
|
}
|
|
103
132
|
|
|
104
133
|
/**
|
|
@@ -114,12 +143,6 @@ declare module 'node:test' {
|
|
|
114
143
|
*/
|
|
115
144
|
type SuiteFn = (done: (result?: any) => void) => void;
|
|
116
145
|
|
|
117
|
-
/**
|
|
118
|
-
* The type of a function under test.
|
|
119
|
-
* If the test uses callbacks, the callback function is passed as an argument
|
|
120
|
-
*/
|
|
121
|
-
type ItFn = (done: (result?: any) => void) => any;
|
|
122
|
-
|
|
123
146
|
interface RunOptions {
|
|
124
147
|
/**
|
|
125
148
|
* If a number is provided, then that many files would run in parallel.
|
|
@@ -202,6 +202,9 @@ declare module 'buffer' {
|
|
|
202
202
|
// the copy below in a Node environment.
|
|
203
203
|
type __Blob = typeof globalThis extends { onmessage: any; Blob: infer T } ? T : NodeBlob;
|
|
204
204
|
global {
|
|
205
|
+
namespace NodeJS {
|
|
206
|
+
export { BufferEncoding };
|
|
207
|
+
}
|
|
205
208
|
// Buffer class
|
|
206
209
|
type BufferEncoding =
|
|
207
210
|
| 'ascii'
|
|
@@ -2280,7 +2283,7 @@ declare module 'buffer' {
|
|
|
2280
2283
|
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
|
2281
2284
|
* **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
|
|
2282
2285
|
* @since v15.13.0, v14.17.0
|
|
2283
|
-
* @
|
|
2286
|
+
* @legacy Use `Buffer.from(data, 'base64')` instead.
|
|
2284
2287
|
* @param data The Base64-encoded input string.
|
|
2285
2288
|
*/
|
|
2286
2289
|
function atob(data: string): string;
|
|
@@ -2296,7 +2299,7 @@ declare module 'buffer' {
|
|
|
2296
2299
|
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
|
2297
2300
|
* **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
|
|
2298
2301
|
* @since v15.13.0, v14.17.0
|
|
2299
|
-
* @
|
|
2302
|
+
* @legacy Use `buf.toString('base64')` instead.
|
|
2300
2303
|
* @param data An ASCII (Latin1) string.
|
|
2301
2304
|
*/
|
|
2302
2305
|
function btoa(data: string): string;
|