@mokup/runtime 1.0.5 → 1.0.7
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/index.cjs +2 -4
- package/dist/index.mjs +1 -3
- package/package.json +4 -7
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const timing = require('@mokup/shared/timing');
|
|
3
4
|
const hono = require('@mokup/shared/hono');
|
|
4
5
|
|
|
5
6
|
const paramNamePattern = /^[\w-]+$/;
|
|
@@ -210,9 +211,6 @@ function normalizeMethod(method) {
|
|
|
210
211
|
}
|
|
211
212
|
return void 0;
|
|
212
213
|
}
|
|
213
|
-
function delay(ms) {
|
|
214
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
215
|
-
}
|
|
216
214
|
|
|
217
215
|
function resolveModuleUrl(modulePath, moduleBase) {
|
|
218
216
|
if (/^(?:data|http|https|file):/.test(modulePath)) {
|
|
@@ -546,7 +544,7 @@ function createFinalizeMiddleware(route) {
|
|
|
546
544
|
const response = await next();
|
|
547
545
|
const resolved = resolveResponse(response, c.res);
|
|
548
546
|
if (route.delay && route.delay > 0) {
|
|
549
|
-
await delay(route.delay);
|
|
547
|
+
await timing.delay(route.delay);
|
|
550
548
|
}
|
|
551
549
|
const overridden = applyRouteOverrides(resolved, route);
|
|
552
550
|
c.res = overridden;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { delay } from '@mokup/shared/timing';
|
|
1
2
|
import { Hono, PatternRouter } from '@mokup/shared/hono';
|
|
2
3
|
export { handle } from '@mokup/shared/hono';
|
|
3
4
|
|
|
@@ -209,9 +210,6 @@ function normalizeMethod(method) {
|
|
|
209
210
|
}
|
|
210
211
|
return void 0;
|
|
211
212
|
}
|
|
212
|
-
function delay(ms) {
|
|
213
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
214
|
-
}
|
|
215
213
|
|
|
216
214
|
function resolveModuleUrl(modulePath, moduleBase) {
|
|
217
215
|
if (/^(?:data|http|https|file):/.test(modulePath)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mokup/runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"description": "Cross-runtime mock matching and response handling for mokup.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://mokup.icebreaker.top",
|
|
@@ -27,16 +27,13 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@mokup/shared": "1.1.
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"typescript": "^5.9.3",
|
|
34
|
-
"unbuild": "^3.6.1"
|
|
30
|
+
"@mokup/shared": "1.1.2"
|
|
35
31
|
},
|
|
36
32
|
"scripts": {
|
|
37
33
|
"build": "unbuild",
|
|
38
34
|
"dev": "unbuild --stub",
|
|
39
35
|
"lint": "eslint .",
|
|
40
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
37
|
+
"test:types": "tsd"
|
|
41
38
|
}
|
|
42
39
|
}
|