@nestia/benchmark 12.0.0-dev.20260619.1 → 12.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -64,13 +64,15 @@ export declare namespace DynamicBenchmarker {
|
|
|
64
64
|
/**
|
|
65
65
|
* Filter function.
|
|
66
66
|
*
|
|
67
|
-
* The filter function
|
|
68
|
-
*
|
|
67
|
+
* The filter function is called with the file name (basename) of each
|
|
68
|
+
* benchmark function module, not with the function name. When it returns
|
|
69
|
+
* `false`, the file would never be imported in the servant, so that every
|
|
70
|
+
* function defined in the file would never be executed either.
|
|
69
71
|
*
|
|
70
|
-
* @param name
|
|
72
|
+
* @param file File name (basename) of the benchmark functions
|
|
71
73
|
* @returns Whether to execute the function or not.
|
|
72
74
|
*/
|
|
73
|
-
filter?: (
|
|
75
|
+
filter?: (file: string) => boolean;
|
|
74
76
|
/**
|
|
75
77
|
* Progress callback function.
|
|
76
78
|
*
|
|
@@ -108,10 +110,10 @@ export declare namespace DynamicBenchmarker {
|
|
|
108
110
|
* Extension of the benchmark function files to load, without the leading
|
|
109
111
|
* dot.
|
|
110
112
|
*
|
|
111
|
-
* The servant reads {@link location} and imports every file ending with
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
113
|
+
* The servant reads {@link location} and imports every file ending with this
|
|
114
|
+
* extension. Set it to match how the feature files are actually run: `"js"`
|
|
115
|
+
* when they are built JavaScript, or `"ts"` when they are executed from
|
|
116
|
+
* TypeScript source (for example under `ttsx`).
|
|
115
117
|
*
|
|
116
118
|
* @default "js"
|
|
117
119
|
*/
|
|
@@ -122,7 +124,9 @@ export declare namespace DynamicBenchmarker {
|
|
|
122
124
|
* Every prefixed function will be executed in the servant.
|
|
123
125
|
*
|
|
124
126
|
* In other words, if a function name doesn't start with the prefix, then it
|
|
125
|
-
* would never be executed.
|
|
127
|
+
* would never be executed. Also, when a file name (basename) does not start
|
|
128
|
+
* with the prefix, the file would never be imported either, so that every
|
|
129
|
+
* function defined in the file would never be executed.
|
|
126
130
|
*/
|
|
127
131
|
prefix: string;
|
|
128
132
|
/**
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -204,14 +237,18 @@ const iterate = (ctx) => (path) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
204
237
|
// nothing, and spin forever.
|
|
205
238
|
else if (file.endsWith(`.${(_a = ctx.props.extension) !== null && _a !== void 0 ? _a : "js"}`) &&
|
|
206
239
|
file.endsWith(".d.ts") === false) {
|
|
207
|
-
|
|
240
|
+
// GATE BY FILE NAME (PREFIX & FILTER), SO THAT EXCLUDED FILES ARE
|
|
241
|
+
// NEVER IMPORTED.
|
|
242
|
+
if (file.startsWith(ctx.props.prefix) === false)
|
|
243
|
+
continue;
|
|
244
|
+
if ((yield ctx.driver.filter(file)) === false)
|
|
245
|
+
continue;
|
|
246
|
+
const modulo = yield Promise.resolve(`${location}`).then(s => __importStar(require(s)));
|
|
208
247
|
for (const [key, value] of Object.entries(modulo)) {
|
|
209
248
|
if (typeof value !== "function")
|
|
210
249
|
continue;
|
|
211
250
|
else if (key.startsWith(ctx.props.prefix) === false)
|
|
212
251
|
continue;
|
|
213
|
-
else if ((yield ctx.driver.filter(key)) === false)
|
|
214
|
-
continue;
|
|
215
252
|
ctx.collection.push({
|
|
216
253
|
key,
|
|
217
254
|
value: value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicBenchmarker.js","sourceRoot":"","sources":["../src/DynamicBenchmarker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DynamicBenchmarker.js","sourceRoot":"","sources":["../src/DynamicBenchmarker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4CAAoB;AACpB,iCAA8D;AAC9D,+BAAgD;AAGhD,kFAA+E;AAI/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;A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@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/benchmark",
|
|
3
|
-
"version": "12.0.0-
|
|
3
|
+
"version": "12.0.0-rc.2",
|
|
4
4
|
"description": "NestJS Performance Benchmark Program",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"tgrid": "^1.2.1",
|
|
33
33
|
"tstl": "^3.0.0",
|
|
34
|
-
"@nestia/fetcher": "^12.0.0-
|
|
34
|
+
"@nestia/fetcher": "^12.0.0-rc.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.3.3",
|
|
@@ -74,13 +74,15 @@ export namespace DynamicBenchmarker {
|
|
|
74
74
|
/**
|
|
75
75
|
* Filter function.
|
|
76
76
|
*
|
|
77
|
-
* The filter function
|
|
78
|
-
*
|
|
77
|
+
* The filter function is called with the file name (basename) of each
|
|
78
|
+
* benchmark function module, not with the function name. When it returns
|
|
79
|
+
* `false`, the file would never be imported in the servant, so that every
|
|
80
|
+
* function defined in the file would never be executed either.
|
|
79
81
|
*
|
|
80
|
-
* @param name
|
|
82
|
+
* @param file File name (basename) of the benchmark functions
|
|
81
83
|
* @returns Whether to execute the function or not.
|
|
82
84
|
*/
|
|
83
|
-
filter?: (
|
|
85
|
+
filter?: (file: string) => boolean;
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* Progress callback function.
|
|
@@ -124,10 +126,10 @@ export namespace DynamicBenchmarker {
|
|
|
124
126
|
* Extension of the benchmark function files to load, without the leading
|
|
125
127
|
* dot.
|
|
126
128
|
*
|
|
127
|
-
* The servant reads {@link location} and imports every file ending with
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* The servant reads {@link location} and imports every file ending with this
|
|
130
|
+
* extension. Set it to match how the feature files are actually run: `"js"`
|
|
131
|
+
* when they are built JavaScript, or `"ts"` when they are executed from
|
|
132
|
+
* TypeScript source (for example under `ttsx`).
|
|
131
133
|
*
|
|
132
134
|
* @default "js"
|
|
133
135
|
*/
|
|
@@ -139,7 +141,9 @@ export namespace DynamicBenchmarker {
|
|
|
139
141
|
* Every prefixed function will be executed in the servant.
|
|
140
142
|
*
|
|
141
143
|
* In other words, if a function name doesn't start with the prefix, then it
|
|
142
|
-
* would never be executed.
|
|
144
|
+
* would never be executed. Also, when a file name (basename) does not start
|
|
145
|
+
* with the prefix, the file would never be imported either, so that every
|
|
146
|
+
* function defined in the file would never be executed.
|
|
143
147
|
*/
|
|
144
148
|
prefix: string;
|
|
145
149
|
|
|
@@ -401,11 +405,14 @@ const iterate =
|
|
|
401
405
|
file.endsWith(`.${ctx.props.extension ?? "js"}`) &&
|
|
402
406
|
file.endsWith(".d.ts") === false
|
|
403
407
|
) {
|
|
408
|
+
// GATE BY FILE NAME (PREFIX & FILTER), SO THAT EXCLUDED FILES ARE
|
|
409
|
+
// NEVER IMPORTED.
|
|
410
|
+
if (file.startsWith(ctx.props.prefix) === false) continue;
|
|
411
|
+
if ((await ctx.driver.filter(file)) === false) continue;
|
|
404
412
|
const modulo = await import(location);
|
|
405
413
|
for (const [key, value] of Object.entries(modulo)) {
|
|
406
414
|
if (typeof value !== "function") continue;
|
|
407
415
|
else if (key.startsWith(ctx.props.prefix) === false) continue;
|
|
408
|
-
else if ((await ctx.driver.filter(key)) === false) continue;
|
|
409
416
|
ctx.collection.push({
|
|
410
417
|
key,
|
|
411
418
|
value: value as (...args: Parameters) => Promise<any>,
|