@mokup/cli 1.0.11 → 1.1.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/index.cjs +67 -461
- package/dist/index.d.cts +16 -35
- package/dist/index.d.mts +16 -35
- package/dist/index.d.ts +16 -35
- package/dist/index.mjs +64 -459
- package/package.json +6 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Manifest } from '@mokup/runtime';
|
|
2
2
|
import { MiddlewareHandler } from '@mokup/shared/hono';
|
|
3
|
+
import * as _mokup_shared_define_config from '@mokup/shared/define-config';
|
|
3
4
|
import { Command } from 'commander';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -164,6 +165,12 @@ interface RouteDirectoryConfig {
|
|
|
164
165
|
* @default undefined
|
|
165
166
|
*/
|
|
166
167
|
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
|
168
|
+
/**
|
|
169
|
+
* Error handling policy for defineConfig hooks.
|
|
170
|
+
*
|
|
171
|
+
* @default "warn"
|
|
172
|
+
*/
|
|
173
|
+
hookError?: HookErrorPolicy;
|
|
167
174
|
}
|
|
168
175
|
/**
|
|
169
176
|
* Middleware execution position.
|
|
@@ -174,6 +181,10 @@ interface RouteDirectoryConfig {
|
|
|
174
181
|
* const position: MiddlewarePosition = 'pre'
|
|
175
182
|
*/
|
|
176
183
|
type MiddlewarePosition = 'pre' | 'normal' | 'post';
|
|
184
|
+
/**
|
|
185
|
+
* Error handling policy for config hooks.
|
|
186
|
+
*/
|
|
187
|
+
type HookErrorPolicy = 'throw' | 'warn' | 'silent';
|
|
177
188
|
/**
|
|
178
189
|
* Middleware registry used by defineConfig.
|
|
179
190
|
*
|
|
@@ -202,39 +213,9 @@ declare function buildManifest(options?: BuildOptions): Promise<{
|
|
|
202
213
|
manifestPath: string;
|
|
203
214
|
}>;
|
|
204
215
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
post: MiddlewareRegistry;
|
|
209
|
-
}) => RouteDirectoryConfig | void;
|
|
210
|
-
/**
|
|
211
|
-
* Define a directory config with Hono-style middleware registration.
|
|
212
|
-
*
|
|
213
|
-
* @param input - Config object or factory callback.
|
|
214
|
-
* @returns Route directory config with middleware metadata.
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* import { defineConfig } from '@mokup/cli'
|
|
218
|
-
*
|
|
219
|
-
* export default defineConfig(({ pre, normal, post }) => {
|
|
220
|
-
* pre.use(async (c, next) => {
|
|
221
|
-
* c.header('x-before', '1')
|
|
222
|
-
* await next()
|
|
223
|
-
* })
|
|
224
|
-
*
|
|
225
|
-
* normal.use(async (_c, next) => {
|
|
226
|
-
* await next()
|
|
227
|
-
* })
|
|
228
|
-
*
|
|
229
|
-
* post.use(async (c, next) => {
|
|
230
|
-
* await next()
|
|
231
|
-
* c.header('x-after', '1')
|
|
232
|
-
* })
|
|
233
|
-
*
|
|
234
|
-
* return { delay: 120 }
|
|
235
|
-
* })
|
|
236
|
-
*/
|
|
237
|
-
declare function defineConfig(input: RouteDirectoryConfig | DefineConfigFactory): RouteDirectoryConfig;
|
|
216
|
+
declare const defineConfig: (input: RouteDirectoryConfig | _mokup_shared_define_config.DefineConfigFactory<RouteDirectoryConfig, MiddlewareHandler>) => RouteDirectoryConfig | Promise<RouteDirectoryConfig>;
|
|
217
|
+
declare const onBeforeAll: (handler: _mokup_shared_define_config.HookHandler) => void;
|
|
218
|
+
declare const onAfterAll: (handler: _mokup_shared_define_config.HookHandler) => void;
|
|
238
219
|
|
|
239
220
|
/**
|
|
240
221
|
* Create the mokup CLI program instance.
|
|
@@ -260,5 +241,5 @@ declare function createCli(): Command;
|
|
|
260
241
|
*/
|
|
261
242
|
declare function runCli(argv?: string[]): Promise<void>;
|
|
262
243
|
|
|
263
|
-
export { buildManifest, createCli, defineConfig, runCli };
|
|
264
|
-
export type { BuildOptions, MiddlewarePosition, MiddlewareRegistry, RouteDirectoryConfig, RouteRule };
|
|
244
|
+
export { buildManifest, createCli, defineConfig, onAfterAll, onBeforeAll, runCli };
|
|
245
|
+
export type { BuildOptions, HookErrorPolicy, MiddlewarePosition, MiddlewareRegistry, RouteDirectoryConfig, RouteRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Manifest } from '@mokup/runtime';
|
|
2
2
|
import { MiddlewareHandler } from '@mokup/shared/hono';
|
|
3
|
+
import * as _mokup_shared_define_config from '@mokup/shared/define-config';
|
|
3
4
|
import { Command } from 'commander';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -164,6 +165,12 @@ interface RouteDirectoryConfig {
|
|
|
164
165
|
* @default undefined
|
|
165
166
|
*/
|
|
166
167
|
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
|
168
|
+
/**
|
|
169
|
+
* Error handling policy for defineConfig hooks.
|
|
170
|
+
*
|
|
171
|
+
* @default "warn"
|
|
172
|
+
*/
|
|
173
|
+
hookError?: HookErrorPolicy;
|
|
167
174
|
}
|
|
168
175
|
/**
|
|
169
176
|
* Middleware execution position.
|
|
@@ -174,6 +181,10 @@ interface RouteDirectoryConfig {
|
|
|
174
181
|
* const position: MiddlewarePosition = 'pre'
|
|
175
182
|
*/
|
|
176
183
|
type MiddlewarePosition = 'pre' | 'normal' | 'post';
|
|
184
|
+
/**
|
|
185
|
+
* Error handling policy for config hooks.
|
|
186
|
+
*/
|
|
187
|
+
type HookErrorPolicy = 'throw' | 'warn' | 'silent';
|
|
177
188
|
/**
|
|
178
189
|
* Middleware registry used by defineConfig.
|
|
179
190
|
*
|
|
@@ -202,39 +213,9 @@ declare function buildManifest(options?: BuildOptions): Promise<{
|
|
|
202
213
|
manifestPath: string;
|
|
203
214
|
}>;
|
|
204
215
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
post: MiddlewareRegistry;
|
|
209
|
-
}) => RouteDirectoryConfig | void;
|
|
210
|
-
/**
|
|
211
|
-
* Define a directory config with Hono-style middleware registration.
|
|
212
|
-
*
|
|
213
|
-
* @param input - Config object or factory callback.
|
|
214
|
-
* @returns Route directory config with middleware metadata.
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* import { defineConfig } from '@mokup/cli'
|
|
218
|
-
*
|
|
219
|
-
* export default defineConfig(({ pre, normal, post }) => {
|
|
220
|
-
* pre.use(async (c, next) => {
|
|
221
|
-
* c.header('x-before', '1')
|
|
222
|
-
* await next()
|
|
223
|
-
* })
|
|
224
|
-
*
|
|
225
|
-
* normal.use(async (_c, next) => {
|
|
226
|
-
* await next()
|
|
227
|
-
* })
|
|
228
|
-
*
|
|
229
|
-
* post.use(async (c, next) => {
|
|
230
|
-
* await next()
|
|
231
|
-
* c.header('x-after', '1')
|
|
232
|
-
* })
|
|
233
|
-
*
|
|
234
|
-
* return { delay: 120 }
|
|
235
|
-
* })
|
|
236
|
-
*/
|
|
237
|
-
declare function defineConfig(input: RouteDirectoryConfig | DefineConfigFactory): RouteDirectoryConfig;
|
|
216
|
+
declare const defineConfig: (input: RouteDirectoryConfig | _mokup_shared_define_config.DefineConfigFactory<RouteDirectoryConfig, MiddlewareHandler>) => RouteDirectoryConfig | Promise<RouteDirectoryConfig>;
|
|
217
|
+
declare const onBeforeAll: (handler: _mokup_shared_define_config.HookHandler) => void;
|
|
218
|
+
declare const onAfterAll: (handler: _mokup_shared_define_config.HookHandler) => void;
|
|
238
219
|
|
|
239
220
|
/**
|
|
240
221
|
* Create the mokup CLI program instance.
|
|
@@ -260,5 +241,5 @@ declare function createCli(): Command;
|
|
|
260
241
|
*/
|
|
261
242
|
declare function runCli(argv?: string[]): Promise<void>;
|
|
262
243
|
|
|
263
|
-
export { buildManifest, createCli, defineConfig, runCli };
|
|
264
|
-
export type { BuildOptions, MiddlewarePosition, MiddlewareRegistry, RouteDirectoryConfig, RouteRule };
|
|
244
|
+
export { buildManifest, createCli, defineConfig, onAfterAll, onBeforeAll, runCli };
|
|
245
|
+
export type { BuildOptions, HookErrorPolicy, MiddlewarePosition, MiddlewareRegistry, RouteDirectoryConfig, RouteRule };
|