@mokup/runtime 1.0.4 → 1.0.6

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 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.d.cts CHANGED
@@ -363,13 +363,13 @@ interface RuntimeOptions {
363
363
  *
364
364
  * @default undefined
365
365
  */
366
- moduleBase?: string | URL;
366
+ moduleBase?: string | URL | undefined;
367
367
  /**
368
368
  * Map of module exports for in-memory execution.
369
369
  *
370
370
  * @default undefined
371
371
  */
372
- moduleMap?: ModuleMap;
372
+ moduleMap?: ModuleMap | undefined;
373
373
  }
374
374
  /**
375
375
  * Map of module path to exported members.
package/dist/index.d.mts CHANGED
@@ -363,13 +363,13 @@ interface RuntimeOptions {
363
363
  *
364
364
  * @default undefined
365
365
  */
366
- moduleBase?: string | URL;
366
+ moduleBase?: string | URL | undefined;
367
367
  /**
368
368
  * Map of module exports for in-memory execution.
369
369
  *
370
370
  * @default undefined
371
371
  */
372
- moduleMap?: ModuleMap;
372
+ moduleMap?: ModuleMap | undefined;
373
373
  }
374
374
  /**
375
375
  * Map of module path to exported members.
package/dist/index.d.ts CHANGED
@@ -363,13 +363,13 @@ interface RuntimeOptions {
363
363
  *
364
364
  * @default undefined
365
365
  */
366
- moduleBase?: string | URL;
366
+ moduleBase?: string | URL | undefined;
367
367
  /**
368
368
  * Map of module exports for in-memory execution.
369
369
  *
370
370
  * @default undefined
371
371
  */
372
- moduleMap?: ModuleMap;
372
+ moduleMap?: ModuleMap | undefined;
373
373
  }
374
374
  /**
375
375
  * Map of module path to exported members.
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",
4
+ "version": "1.0.6",
5
5
  "description": "Cross-runtime mock matching and response handling for mokup.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://mokup.icebreaker.top",
@@ -27,7 +27,7 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@mokup/shared": "1.1.0"
30
+ "@mokup/shared": "1.1.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "typescript": "^5.9.3",