@mokup/server 1.1.8 → 1.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/fetch.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRuntime } from '@mokup/runtime';
2
- import { t as toRuntimeOptions, d as toRuntimeRequestFromFetch, e as toArrayBuffer } from './shared/server.LbftO9Jh.mjs';
2
+ import { t as toRuntimeOptions, d as toRuntimeRequestFromFetch, e as toArrayBuffer } from './shared/server.B5ThEHd_.mjs';
3
3
 
4
4
  function createFetchHandler(options) {
5
5
  const runtime = createRuntime(toRuntimeOptions(options));
package/dist/hono.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fetch = require('./fetch.cjs');
4
4
  require('@mokup/runtime');
5
- require('./shared/server.aaygIV2Q.cjs');
5
+ require('./shared/server.D0X6h49r.cjs');
6
6
 
7
7
  function createHonoMiddleware(options) {
8
8
  const handler = fetch.createFetchHandler(options);
package/dist/hono.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createFetchHandler } from './fetch.mjs';
2
2
  import '@mokup/runtime';
3
- import './shared/server.LbftO9Jh.mjs';
3
+ import './shared/server.B5ThEHd_.mjs';
4
4
 
5
5
  function createHonoMiddleware(options) {
6
6
  const handler = createFetchHandler(options);
package/dist/index.cjs CHANGED
@@ -1,43 +1,20 @@
1
1
  'use strict';
2
2
 
3
+ const defineConfig$1 = require('@mokup/shared/define-config');
3
4
  const fetch = require('./fetch.cjs');
4
5
  const worker = require('./worker.cjs');
5
6
  require('@mokup/runtime');
6
- require('./shared/server.aaygIV2Q.cjs');
7
+ require('./shared/server.D0X6h49r.cjs');
7
8
 
8
- const middlewareSymbol = Symbol.for("mokup.config.middlewares");
9
- function createRegistry(list) {
10
- return {
11
- use: (...handlers) => {
12
- list.push(...handlers);
13
- }
14
- };
15
- }
16
- function attachMetadata(config, meta) {
17
- Object.defineProperty(config, middlewareSymbol, {
18
- value: meta,
19
- enumerable: false
20
- });
21
- return config;
22
- }
23
- function defineConfig(input) {
24
- if (typeof input === "function") {
25
- const pre = [];
26
- const normal = [];
27
- const post = [];
28
- const context = {
29
- pre: createRegistry(pre),
30
- normal: createRegistry(normal),
31
- post: createRegistry(post)
32
- };
33
- const result = input(context);
34
- const config2 = result && typeof result === "object" ? result : {};
35
- return attachMetadata(config2, { pre, normal, post });
36
- }
37
- const config = input && typeof input === "object" ? input : {};
38
- return attachMetadata(config, { pre: [], normal: [], post: [] });
39
- }
9
+ const shared = defineConfig$1.createDefineConfig({
10
+ logPrefix: "[@mokup/server]"
11
+ });
12
+ const defineConfig = shared.defineConfig;
13
+ const onBeforeAll = shared.onBeforeAll;
14
+ const onAfterAll = shared.onAfterAll;
40
15
 
41
16
  exports.createFetchHandler = fetch.createFetchHandler;
42
17
  exports.createMokupWorker = worker.createMokupWorker;
43
18
  exports.defineConfig = defineConfig;
19
+ exports.onAfterAll = onAfterAll;
20
+ exports.onBeforeAll = onBeforeAll;
package/dist/index.d.cts CHANGED
@@ -1,43 +1,15 @@
1
- import { R as RouteDirectoryConfig, M as MiddlewareRegistry } from './shared/server.CyVIKPsp.cjs';
2
- export { a as MiddlewarePosition, b as ResolvedMiddleware, c as RouteRule } from './shared/server.CyVIKPsp.cjs';
1
+ import * as _mokup_shared_define_config from '@mokup/shared/define-config';
2
+ import { R as RouteDirectoryConfig } from './shared/server.DLPB_I9q.cjs';
3
+ export { H as HookErrorPolicy, M as MiddlewarePosition, a as MiddlewareRegistry, b as ResolvedMiddleware, c as RouteRule } from './shared/server.DLPB_I9q.cjs';
4
+ import { MiddlewareHandler } from '@mokup/shared/hono';
5
+ export { MiddlewareHandler } from '@mokup/shared/hono';
3
6
  export { createFetchHandler } from './fetch.cjs';
4
7
  export { F as FetchHandler, S as ServerOptions, W as WorkerBundle, a as WorkerInput } from './shared/server.LMr0or7K.cjs';
5
8
  export { createMokupWorker } from './worker.cjs';
6
9
  export { Manifest, ManifestRoute, ModuleMap, RuntimeOptions } from '@mokup/runtime';
7
- export { MiddlewareHandler } from '@mokup/shared/hono';
8
10
 
9
- type DefineConfigFactory = (context: {
10
- pre: MiddlewareRegistry;
11
- normal: MiddlewareRegistry;
12
- post: MiddlewareRegistry;
13
- }) => RouteDirectoryConfig | void;
14
- /**
15
- * Define a directory config with Hono-style middleware registration.
16
- *
17
- * @param input - Config object or factory callback.
18
- * @returns Route directory config with middleware metadata.
19
- *
20
- * @example
21
- * import { defineConfig } from '@mokup/server'
22
- *
23
- * export default defineConfig(({ pre, normal, post }) => {
24
- * pre.use(async (c, next) => {
25
- * c.header('x-before', '1')
26
- * await next()
27
- * })
28
- *
29
- * normal.use(async (_c, next) => {
30
- * await next()
31
- * })
32
- *
33
- * post.use(async (c, next) => {
34
- * await next()
35
- * c.header('x-after', '1')
36
- * })
37
- *
38
- * return { delay: 120 }
39
- * })
40
- */
41
- declare function defineConfig(input: RouteDirectoryConfig | DefineConfigFactory): RouteDirectoryConfig;
11
+ declare const defineConfig: (input: RouteDirectoryConfig | _mokup_shared_define_config.DefineConfigFactory<RouteDirectoryConfig, MiddlewareHandler>) => RouteDirectoryConfig | Promise<RouteDirectoryConfig>;
12
+ declare const onBeforeAll: (handler: _mokup_shared_define_config.HookHandler) => void;
13
+ declare const onAfterAll: (handler: _mokup_shared_define_config.HookHandler) => void;
42
14
 
43
- export { MiddlewareRegistry, RouteDirectoryConfig, defineConfig };
15
+ export { RouteDirectoryConfig, defineConfig, onAfterAll, onBeforeAll };
package/dist/index.d.mts CHANGED
@@ -1,43 +1,15 @@
1
- import { R as RouteDirectoryConfig, M as MiddlewareRegistry } from './shared/server.CyVIKPsp.mjs';
2
- export { a as MiddlewarePosition, b as ResolvedMiddleware, c as RouteRule } from './shared/server.CyVIKPsp.mjs';
1
+ import * as _mokup_shared_define_config from '@mokup/shared/define-config';
2
+ import { R as RouteDirectoryConfig } from './shared/server.DLPB_I9q.mjs';
3
+ export { H as HookErrorPolicy, M as MiddlewarePosition, a as MiddlewareRegistry, b as ResolvedMiddleware, c as RouteRule } from './shared/server.DLPB_I9q.mjs';
4
+ import { MiddlewareHandler } from '@mokup/shared/hono';
5
+ export { MiddlewareHandler } from '@mokup/shared/hono';
3
6
  export { createFetchHandler } from './fetch.mjs';
4
7
  export { F as FetchHandler, S as ServerOptions, W as WorkerBundle, a as WorkerInput } from './shared/server.LMr0or7K.mjs';
5
8
  export { createMokupWorker } from './worker.mjs';
6
9
  export { Manifest, ManifestRoute, ModuleMap, RuntimeOptions } from '@mokup/runtime';
7
- export { MiddlewareHandler } from '@mokup/shared/hono';
8
10
 
9
- type DefineConfigFactory = (context: {
10
- pre: MiddlewareRegistry;
11
- normal: MiddlewareRegistry;
12
- post: MiddlewareRegistry;
13
- }) => RouteDirectoryConfig | void;
14
- /**
15
- * Define a directory config with Hono-style middleware registration.
16
- *
17
- * @param input - Config object or factory callback.
18
- * @returns Route directory config with middleware metadata.
19
- *
20
- * @example
21
- * import { defineConfig } from '@mokup/server'
22
- *
23
- * export default defineConfig(({ pre, normal, post }) => {
24
- * pre.use(async (c, next) => {
25
- * c.header('x-before', '1')
26
- * await next()
27
- * })
28
- *
29
- * normal.use(async (_c, next) => {
30
- * await next()
31
- * })
32
- *
33
- * post.use(async (c, next) => {
34
- * await next()
35
- * c.header('x-after', '1')
36
- * })
37
- *
38
- * return { delay: 120 }
39
- * })
40
- */
41
- declare function defineConfig(input: RouteDirectoryConfig | DefineConfigFactory): RouteDirectoryConfig;
11
+ declare const defineConfig: (input: RouteDirectoryConfig | _mokup_shared_define_config.DefineConfigFactory<RouteDirectoryConfig, MiddlewareHandler>) => RouteDirectoryConfig | Promise<RouteDirectoryConfig>;
12
+ declare const onBeforeAll: (handler: _mokup_shared_define_config.HookHandler) => void;
13
+ declare const onAfterAll: (handler: _mokup_shared_define_config.HookHandler) => void;
42
14
 
43
- export { MiddlewareRegistry, RouteDirectoryConfig, defineConfig };
15
+ export { RouteDirectoryConfig, defineConfig, onAfterAll, onBeforeAll };
package/dist/index.d.ts CHANGED
@@ -1,43 +1,15 @@
1
- import { R as RouteDirectoryConfig, M as MiddlewareRegistry } from './shared/server.CyVIKPsp.js';
2
- export { a as MiddlewarePosition, b as ResolvedMiddleware, c as RouteRule } from './shared/server.CyVIKPsp.js';
1
+ import * as _mokup_shared_define_config from '@mokup/shared/define-config';
2
+ import { R as RouteDirectoryConfig } from './shared/server.DLPB_I9q.js';
3
+ export { H as HookErrorPolicy, M as MiddlewarePosition, a as MiddlewareRegistry, b as ResolvedMiddleware, c as RouteRule } from './shared/server.DLPB_I9q.js';
4
+ import { MiddlewareHandler } from '@mokup/shared/hono';
5
+ export { MiddlewareHandler } from '@mokup/shared/hono';
3
6
  export { createFetchHandler } from './fetch.js';
4
7
  export { F as FetchHandler, S as ServerOptions, W as WorkerBundle, a as WorkerInput } from './shared/server.LMr0or7K.js';
5
8
  export { createMokupWorker } from './worker.js';
6
9
  export { Manifest, ManifestRoute, ModuleMap, RuntimeOptions } from '@mokup/runtime';
7
- export { MiddlewareHandler } from '@mokup/shared/hono';
8
10
 
9
- type DefineConfigFactory = (context: {
10
- pre: MiddlewareRegistry;
11
- normal: MiddlewareRegistry;
12
- post: MiddlewareRegistry;
13
- }) => RouteDirectoryConfig | void;
14
- /**
15
- * Define a directory config with Hono-style middleware registration.
16
- *
17
- * @param input - Config object or factory callback.
18
- * @returns Route directory config with middleware metadata.
19
- *
20
- * @example
21
- * import { defineConfig } from '@mokup/server'
22
- *
23
- * export default defineConfig(({ pre, normal, post }) => {
24
- * pre.use(async (c, next) => {
25
- * c.header('x-before', '1')
26
- * await next()
27
- * })
28
- *
29
- * normal.use(async (_c, next) => {
30
- * await next()
31
- * })
32
- *
33
- * post.use(async (c, next) => {
34
- * await next()
35
- * c.header('x-after', '1')
36
- * })
37
- *
38
- * return { delay: 120 }
39
- * })
40
- */
41
- declare function defineConfig(input: RouteDirectoryConfig | DefineConfigFactory): RouteDirectoryConfig;
11
+ declare const defineConfig: (input: RouteDirectoryConfig | _mokup_shared_define_config.DefineConfigFactory<RouteDirectoryConfig, MiddlewareHandler>) => RouteDirectoryConfig | Promise<RouteDirectoryConfig>;
12
+ declare const onBeforeAll: (handler: _mokup_shared_define_config.HookHandler) => void;
13
+ declare const onAfterAll: (handler: _mokup_shared_define_config.HookHandler) => void;
42
14
 
43
- export { MiddlewareRegistry, RouteDirectoryConfig, defineConfig };
15
+ export { RouteDirectoryConfig, defineConfig, onAfterAll, onBeforeAll };
package/dist/index.mjs CHANGED
@@ -1,39 +1,14 @@
1
+ import { createDefineConfig } from '@mokup/shared/define-config';
1
2
  export { createFetchHandler } from './fetch.mjs';
2
3
  export { createMokupWorker } from './worker.mjs';
3
4
  import '@mokup/runtime';
4
- import './shared/server.LbftO9Jh.mjs';
5
+ import './shared/server.B5ThEHd_.mjs';
5
6
 
6
- const middlewareSymbol = Symbol.for("mokup.config.middlewares");
7
- function createRegistry(list) {
8
- return {
9
- use: (...handlers) => {
10
- list.push(...handlers);
11
- }
12
- };
13
- }
14
- function attachMetadata(config, meta) {
15
- Object.defineProperty(config, middlewareSymbol, {
16
- value: meta,
17
- enumerable: false
18
- });
19
- return config;
20
- }
21
- function defineConfig(input) {
22
- if (typeof input === "function") {
23
- const pre = [];
24
- const normal = [];
25
- const post = [];
26
- const context = {
27
- pre: createRegistry(pre),
28
- normal: createRegistry(normal),
29
- post: createRegistry(post)
30
- };
31
- const result = input(context);
32
- const config2 = result && typeof result === "object" ? result : {};
33
- return attachMetadata(config2, { pre, normal, post });
34
- }
35
- const config = input && typeof input === "object" ? input : {};
36
- return attachMetadata(config, { pre: [], normal: [], post: [] });
37
- }
7
+ const shared = createDefineConfig({
8
+ logPrefix: "[@mokup/server]"
9
+ });
10
+ const defineConfig = shared.defineConfig;
11
+ const onBeforeAll = shared.onBeforeAll;
12
+ const onAfterAll = shared.onAfterAll;
38
13
 
39
- export { defineConfig };
14
+ export { defineConfig, onAfterAll, onBeforeAll };
package/dist/koa.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const runtime = require('@mokup/runtime');
4
- const runtime$1 = require('./shared/server.aaygIV2Q.cjs');
4
+ const runtime$1 = require('./shared/server.D0X6h49r.cjs');
5
5
 
6
6
  function createKoaMiddleware(options) {
7
7
  const runtime$2 = runtime.createRuntime(runtime$1.toRuntimeOptions(options));
package/dist/koa.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRuntime } from '@mokup/runtime';
2
- import { t as toRuntimeOptions, a as toRuntimeRequestFromNode, c as toBinaryBody } from './shared/server.LbftO9Jh.mjs';
2
+ import { t as toRuntimeOptions, a as toRuntimeRequestFromNode, c as toBinaryBody } from './shared/server.B5ThEHd_.mjs';
3
3
 
4
4
  function createKoaMiddleware(options) {
5
5
  const runtime = createRuntime(toRuntimeOptions(options));
package/dist/node.cjs CHANGED
@@ -9,21 +9,25 @@ const koa = require('./koa.cjs');
9
9
  const workerNode = require('./worker-node.cjs');
10
10
  const nodeServer = require('@hono/node-server');
11
11
  require('@mokup/runtime');
12
- require('./shared/server.aaygIV2Q.cjs');
12
+ require('./shared/server.D0X6h49r.cjs');
13
13
  require('@mokup/shared/pathe');
14
14
  require('node:fs');
15
15
  require('node:module');
16
16
  require('@mokup/shared/playground-grouping');
17
+ require('@mokup/shared/route-utils');
18
+ require('@mokup/shared/config-utils');
19
+ require('@mokup/shared/module-loader');
20
+ require('@mokup/shared/route-constants');
21
+ require('@mokup/shared/mock-files');
22
+ require('@mokup/shared/load-rules');
23
+ require('@mokup/shared/scan-utils');
17
24
  require('@mokup/shared/path-utils');
18
25
  require('@mokup/shared/timing');
19
- require('node:buffer');
20
- require('node:url');
21
- require('@mokup/shared/esbuild');
22
- require('node:process');
23
- require('@mokup/shared/jsonc-parser');
24
26
  require('@mokup/shared/hono');
27
+ require('node:process');
25
28
  require('./fetch.cjs');
26
29
  require('node:path');
30
+ require('node:url');
27
31
 
28
32
 
29
33
 
package/dist/node.d.cts CHANGED
@@ -9,6 +9,6 @@ export { serve } from '@hono/node-server';
9
9
  import './shared/server.D0gAciOr.cjs';
10
10
  import './shared/server.LMr0or7K.cjs';
11
11
  import '@mokup/runtime';
12
- import './shared/server.CyVIKPsp.cjs';
12
+ import './shared/server.DLPB_I9q.cjs';
13
13
  import '@mokup/shared/hono';
14
14
  import '@mokup/shared';
package/dist/node.d.mts CHANGED
@@ -9,6 +9,6 @@ export { serve } from '@hono/node-server';
9
9
  import './shared/server.D0gAciOr.mjs';
10
10
  import './shared/server.LMr0or7K.mjs';
11
11
  import '@mokup/runtime';
12
- import './shared/server.CyVIKPsp.mjs';
12
+ import './shared/server.DLPB_I9q.mjs';
13
13
  import '@mokup/shared/hono';
14
14
  import '@mokup/shared';
package/dist/node.d.ts CHANGED
@@ -9,6 +9,6 @@ export { serve } from '@hono/node-server';
9
9
  import './shared/server.D0gAciOr.js';
10
10
  import './shared/server.LMr0or7K.js';
11
11
  import '@mokup/runtime';
12
- import './shared/server.CyVIKPsp.js';
12
+ import './shared/server.DLPB_I9q.js';
13
13
  import '@mokup/shared/hono';
14
14
  import '@mokup/shared';
package/dist/node.mjs CHANGED
@@ -7,18 +7,22 @@ export { createKoaMiddleware } from './koa.mjs';
7
7
  export { createMokupWorker } from './worker-node.mjs';
8
8
  export { serve } from '@hono/node-server';
9
9
  import '@mokup/runtime';
10
- import './shared/server.LbftO9Jh.mjs';
10
+ import './shared/server.B5ThEHd_.mjs';
11
11
  import '@mokup/shared/pathe';
12
12
  import 'node:fs';
13
13
  import 'node:module';
14
14
  import '@mokup/shared/playground-grouping';
15
+ import '@mokup/shared/route-utils';
16
+ import '@mokup/shared/config-utils';
17
+ import '@mokup/shared/module-loader';
18
+ import '@mokup/shared/route-constants';
19
+ import '@mokup/shared/mock-files';
20
+ import '@mokup/shared/load-rules';
21
+ import '@mokup/shared/scan-utils';
15
22
  import '@mokup/shared/path-utils';
16
23
  import '@mokup/shared/timing';
17
- import 'node:buffer';
18
- import 'node:url';
19
- import '@mokup/shared/esbuild';
20
- import 'node:process';
21
- import '@mokup/shared/jsonc-parser';
22
24
  import '@mokup/shared/hono';
25
+ import 'node:process';
23
26
  import './fetch.mjs';
24
27
  import 'node:path';
28
+ import 'node:url';
@@ -193,7 +193,7 @@ async function toRuntimeRequestFromFetch(request) {
193
193
  async function toRuntimeRequestFromNode(req, bodyOverride) {
194
194
  const headers = normalizeNodeHeaders(req.headers);
195
195
  const contentType = (headers["content-type"] ?? "").split(";")[0]?.trim() ?? "";
196
- const url = resolveUrl(req.originalUrl ?? req.url ?? "/", headers);
196
+ const url = resolveUrl(req.url ?? req.originalUrl ?? "/", headers);
197
197
  const resolvedBody = await resolveBody(
198
198
  typeof bodyOverride === "undefined" ? req.body : bodyOverride,
199
199
  contentType,
@@ -195,7 +195,7 @@ async function toRuntimeRequestFromFetch(request) {
195
195
  async function toRuntimeRequestFromNode(req, bodyOverride) {
196
196
  const headers = normalizeNodeHeaders(req.headers);
197
197
  const contentType = (headers["content-type"] ?? "").split(";")[0]?.trim() ?? "";
198
- const url = resolveUrl(req.originalUrl ?? req.url ?? "/", headers);
198
+ const url = resolveUrl(req.url ?? req.originalUrl ?? "/", headers);
199
199
  const resolvedBody = await resolveBody(
200
200
  typeof bodyOverride === "undefined" ? req.body : bodyOverride,
201
201
  contentType,
@@ -141,6 +141,12 @@ interface RouteDirectoryConfig {
141
141
  * @default undefined
142
142
  */
143
143
  middleware?: MiddlewareHandler | MiddlewareHandler[];
144
+ /**
145
+ * Error handling policy for defineConfig hooks.
146
+ *
147
+ * @default "warn"
148
+ */
149
+ hookError?: HookErrorPolicy;
144
150
  }
145
151
  /**
146
152
  * Middleware execution position.
@@ -151,6 +157,10 @@ interface RouteDirectoryConfig {
151
157
  * const position: MiddlewarePosition = 'pre'
152
158
  */
153
159
  type MiddlewarePosition = 'pre' | 'normal' | 'post';
160
+ /**
161
+ * Error handling policy for config hooks.
162
+ */
163
+ type HookErrorPolicy = 'throw' | 'warn' | 'silent';
154
164
  /**
155
165
  * Middleware registry used by defineConfig.
156
166
  *
@@ -211,4 +221,4 @@ interface ResolvedRoute {
211
221
  }
212
222
  type RouteTable = ResolvedRoute[];
213
223
 
214
- export type { MiddlewareRegistry as M, RouteDirectoryConfig as R, MiddlewarePosition as a, ResolvedMiddleware as b, RouteRule as c, RouteTable as d };
224
+ export type { HookErrorPolicy as H, MiddlewarePosition as M, RouteDirectoryConfig as R, MiddlewareRegistry as a, ResolvedMiddleware as b, RouteRule as c, RouteTable as d };
@@ -141,6 +141,12 @@ interface RouteDirectoryConfig {
141
141
  * @default undefined
142
142
  */
143
143
  middleware?: MiddlewareHandler | MiddlewareHandler[];
144
+ /**
145
+ * Error handling policy for defineConfig hooks.
146
+ *
147
+ * @default "warn"
148
+ */
149
+ hookError?: HookErrorPolicy;
144
150
  }
145
151
  /**
146
152
  * Middleware execution position.
@@ -151,6 +157,10 @@ interface RouteDirectoryConfig {
151
157
  * const position: MiddlewarePosition = 'pre'
152
158
  */
153
159
  type MiddlewarePosition = 'pre' | 'normal' | 'post';
160
+ /**
161
+ * Error handling policy for config hooks.
162
+ */
163
+ type HookErrorPolicy = 'throw' | 'warn' | 'silent';
154
164
  /**
155
165
  * Middleware registry used by defineConfig.
156
166
  *
@@ -211,4 +221,4 @@ interface ResolvedRoute {
211
221
  }
212
222
  type RouteTable = ResolvedRoute[];
213
223
 
214
- export type { MiddlewareRegistry as M, RouteDirectoryConfig as R, MiddlewarePosition as a, ResolvedMiddleware as b, RouteRule as c, RouteTable as d };
224
+ export type { HookErrorPolicy as H, MiddlewarePosition as M, RouteDirectoryConfig as R, MiddlewareRegistry as a, ResolvedMiddleware as b, RouteRule as c, RouteTable as d };
@@ -141,6 +141,12 @@ interface RouteDirectoryConfig {
141
141
  * @default undefined
142
142
  */
143
143
  middleware?: MiddlewareHandler | MiddlewareHandler[];
144
+ /**
145
+ * Error handling policy for defineConfig hooks.
146
+ *
147
+ * @default "warn"
148
+ */
149
+ hookError?: HookErrorPolicy;
144
150
  }
145
151
  /**
146
152
  * Middleware execution position.
@@ -151,6 +157,10 @@ interface RouteDirectoryConfig {
151
157
  * const position: MiddlewarePosition = 'pre'
152
158
  */
153
159
  type MiddlewarePosition = 'pre' | 'normal' | 'post';
160
+ /**
161
+ * Error handling policy for config hooks.
162
+ */
163
+ type HookErrorPolicy = 'throw' | 'warn' | 'silent';
154
164
  /**
155
165
  * Middleware registry used by defineConfig.
156
166
  *
@@ -211,4 +221,4 @@ interface ResolvedRoute {
211
221
  }
212
222
  type RouteTable = ResolvedRoute[];
213
223
 
214
- export type { MiddlewareRegistry as M, RouteDirectoryConfig as R, MiddlewarePosition as a, ResolvedMiddleware as b, RouteRule as c, RouteTable as d };
224
+ export type { HookErrorPolicy as H, MiddlewarePosition as M, RouteDirectoryConfig as R, MiddlewareRegistry as a, ResolvedMiddleware as b, RouteRule as c, RouteTable as d };
@@ -4,7 +4,7 @@ const node_path = require('node:path');
4
4
  const node_url = require('node:url');
5
5
  const fetch = require('./fetch.cjs');
6
6
  require('@mokup/runtime');
7
- require('./shared/server.aaygIV2Q.cjs');
7
+ require('./shared/server.D0X6h49r.cjs');
8
8
 
9
9
  function ensureTrailingSlash(value) {
10
10
  return value.endsWith("/") ? value : `${value}/`;
@@ -2,7 +2,7 @@ import { resolve } from 'node:path';
2
2
  import { pathToFileURL } from 'node:url';
3
3
  import { createFetchHandler } from './fetch.mjs';
4
4
  import '@mokup/runtime';
5
- import './shared/server.LbftO9Jh.mjs';
5
+ import './shared/server.B5ThEHd_.mjs';
6
6
 
7
7
  function ensureTrailingSlash(value) {
8
8
  return value.endsWith("/") ? value : `${value}/`;
package/dist/worker.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fetch = require('./fetch.cjs');
4
4
  require('@mokup/runtime');
5
- require('./shared/server.aaygIV2Q.cjs');
5
+ require('./shared/server.D0X6h49r.cjs');
6
6
 
7
7
  function isStringInput(value) {
8
8
  return typeof value === "string";
package/dist/worker.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createFetchHandler } from './fetch.mjs';
2
2
  import '@mokup/runtime';
3
- import './shared/server.LbftO9Jh.mjs';
3
+ import './shared/server.B5ThEHd_.mjs';
4
4
 
5
5
  function isStringInput(value) {
6
6
  return typeof value === "string";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mokup/server",
3
3
  "type": "module",
4
- "version": "1.1.8",
4
+ "version": "1.2.1",
5
5
  "description": "Server adapters for @mokup/runtime.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://mokup.icebreaker.top",
@@ -79,20 +79,15 @@
79
79
  "dependencies": {
80
80
  "@hono/node-server": "^1.19.9",
81
81
  "@hono/node-ws": "^1.1.1",
82
- "tsx": "^4.21.0",
83
- "@mokup/playground": "0.0.15",
84
- "@mokup/runtime": "1.0.6",
85
- "@mokup/shared": "1.1.1"
86
- },
87
- "devDependencies": {
88
- "@types/node": "^25.0.10",
89
- "typescript": "^5.9.3",
90
- "unbuild": "^3.6.1"
82
+ "@mokup/playground": "0.1.0",
83
+ "@mokup/runtime": "1.0.7",
84
+ "@mokup/shared": "1.1.2"
91
85
  },
92
86
  "scripts": {
93
87
  "build": "unbuild",
94
88
  "dev": "unbuild --stub",
95
89
  "lint": "eslint .",
96
- "typecheck": "tsc -p tsconfig.json --noEmit"
90
+ "typecheck": "tsc -p tsconfig.json --noEmit",
91
+ "test:types": "tsd"
97
92
  }
98
93
  }