@stuntman/server 0.2.0 → 0.2.1
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/rules/loadRules.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.loadRules = exports.DEFAULT_RULES = void 0;
|
|
30
30
|
const fs_1 = __importDefault(require("fs"));
|
|
31
|
-
const glob_1 =
|
|
31
|
+
const glob_1 = require("glob");
|
|
32
32
|
const tsImport = __importStar(require("ts-import"));
|
|
33
33
|
const catchAll_1 = require("./catchAll");
|
|
34
34
|
const echo_1 = require("./echo");
|
|
@@ -41,7 +41,7 @@ const loadRules = () => {
|
|
|
41
41
|
return [];
|
|
42
42
|
}
|
|
43
43
|
shared_1.logger.debug({ rulesPath: shared_1.stuntmanConfig.mock.rulesPath }, `loading additional rules`);
|
|
44
|
-
const filePaths = glob_1.
|
|
44
|
+
const filePaths = (0, glob_1.globSync)('*.[tj]s', { absolute: true, cwd: shared_1.stuntmanConfig.mock.rulesPath });
|
|
45
45
|
const tsImportCompiledFileNames = filePaths.map((p) => p.replace(/\.[^/.]+$/u, '.js'));
|
|
46
46
|
const tsImportDuplicatedCompiledFileNames = tsImportCompiledFileNames.filter((currentValue, currentIndex) => tsImportCompiledFileNames.indexOf(currentValue) !== currentIndex);
|
|
47
47
|
if (tsImportDuplicatedCompiledFileNames.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRules.js","sourceRoot":"","sources":["../../src/rules/loadRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB
|
|
1
|
+
{"version":3,"file":"loadRules.js","sourceRoot":"","sources":["../../src/rules/loadRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,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qBAAqB,CAAC,CAAC;KAC1C;IACD,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AA3CW,QAAA,SAAS,aA2CpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stuntman/server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Stuntman - HTTP proxy / mock server with API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"author": "Andrzej Pasterczyk",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@stuntman/shared": "^0.1
|
|
35
|
+
"@stuntman/shared": "^0.2.1",
|
|
36
36
|
"await-lock": "2.2.2",
|
|
37
37
|
"express": "5.0.0-beta.1",
|
|
38
|
-
"glob": "
|
|
39
|
-
"lru-cache": "7.
|
|
38
|
+
"glob": "9.2.1",
|
|
39
|
+
"lru-cache": "7.18.3",
|
|
40
40
|
"object-sizeof": "2.6.1",
|
|
41
41
|
"pug": "3.0.2",
|
|
42
42
|
"serialize-javascript": "6.0.1",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"uuid": "9.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@jest/globals": "29.
|
|
48
|
+
"@jest/globals": "29.5.0",
|
|
49
49
|
"@prettier/plugin-pug": "2.4.1",
|
|
50
50
|
"@types/express": "4.17.17",
|
|
51
51
|
"@types/glob": "8.1.0",
|
|
52
52
|
"@types/serialize-javascript": "5.0.2",
|
|
53
|
-
"@types/uuid": "9.0.
|
|
54
|
-
"jest": "29.
|
|
53
|
+
"@types/uuid": "9.0.1",
|
|
54
|
+
"jest": "29.5.0",
|
|
55
55
|
"prettier": "2.8.4",
|
|
56
56
|
"typescript": "4.9.5"
|
|
57
57
|
},
|
package/src/rules/loadRules.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import
|
|
2
|
+
import { globSync } from 'glob';
|
|
3
3
|
import * as tsImport from 'ts-import';
|
|
4
4
|
import { catchAllRule } from './catchAll';
|
|
5
5
|
import { echoRule } from './echo';
|
|
@@ -15,7 +15,7 @@ export const loadRules = (): Stuntman.DeployedRule[] => {
|
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
logger.debug({ rulesPath: stuntmanConfig.mock.rulesPath }, `loading additional rules`);
|
|
18
|
-
const filePaths =
|
|
18
|
+
const filePaths = globSync('*.[tj]s', { absolute: true, cwd: stuntmanConfig.mock.rulesPath });
|
|
19
19
|
const tsImportCompiledFileNames = filePaths.map((p) => p.replace(/\.[^/.]+$/u, '.js'));
|
|
20
20
|
const tsImportDuplicatedCompiledFileNames = tsImportCompiledFileNames.filter(
|
|
21
21
|
(currentValue, currentIndex) => tsImportCompiledFileNames.indexOf(currentValue) !== currentIndex
|