@lark-apaas/devtool-kits 1.2.17-alpha.50 → 1.2.17-alpha.52
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/bin/generate-page-routes.cjs +99 -63
- package/dist/bin/generate-page-routes.cjs.map +1 -1
- package/dist/bin/generate-page-routes.js +5 -132
- package/dist/bin/generate-page-routes.js.map +1 -1
- package/dist/chunk-YPNLFWHQ.js +189 -0
- package/dist/chunk-YPNLFWHQ.js.map +1 -0
- package/dist/index.cjs +214 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { RequestHandler, Router, Application } from 'express';
|
|
3
|
+
import * as t from '@babel/types';
|
|
3
4
|
import { IncomingMessage as IncomingMessage$1, ServerResponse as ServerResponse$1 } from 'http';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -280,4 +281,30 @@ declare function getQueryParam(req: AnyRequest, key: string): string | undefined
|
|
|
280
281
|
*/
|
|
281
282
|
declare function registerMiddlewares(server: ExpressApp | ViteMiddleware, middlewares: Middleware[], options?: Partial<MiddlewareContext>): Promise<void>;
|
|
282
283
|
|
|
283
|
-
|
|
284
|
+
interface PageRouteInfo {
|
|
285
|
+
path?: string;
|
|
286
|
+
index?: boolean;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface ParseRoutesOptions {
|
|
290
|
+
/** If true, prefix all routes with basePath. Default: true */
|
|
291
|
+
applyBasePath?: boolean;
|
|
292
|
+
}
|
|
293
|
+
declare function routeParserLog(level: 'log' | 'warn' | 'error' | 'info', message: string, ...args: unknown[]): void;
|
|
294
|
+
declare function calculateFileHash(filePath: string): string | null;
|
|
295
|
+
declare function isRouteComponent(openingElement: t.JSXOpeningElement): boolean;
|
|
296
|
+
declare function evaluateTemplateLiteral(templateLiteral: t.TemplateLiteral): string;
|
|
297
|
+
declare function extractPageRouteInfo(openingElement: t.JSXOpeningElement): PageRouteInfo;
|
|
298
|
+
declare function buildFullPath(routeStack: PageRouteInfo[], currentRoute: PageRouteInfo): string | null;
|
|
299
|
+
/**
|
|
300
|
+
* Parse routes from the app file at build time.
|
|
301
|
+
* @param appPath - Path to app.tsx (relative to cwd or absolute)
|
|
302
|
+
* @param basePath - Normalized base path prefix (e.g., '/my_plugin', or '' for no prefix)
|
|
303
|
+
* @param options - Parse options
|
|
304
|
+
* @returns Array of route definitions
|
|
305
|
+
*/
|
|
306
|
+
declare function parseRoutesFromFile(appPath: string, basePath: string, options?: ParseRoutesOptions): Array<{
|
|
307
|
+
path: string;
|
|
308
|
+
}>;
|
|
309
|
+
|
|
310
|
+
export { type GlobalMiddleware, type Middleware, type MiddlewareContext, type Options, type PageRouteInfo, type ParseRoutesOptions, type RouteInfo, type RouteMiddleware, buildFullPath, calculateFileHash, createCollectLogsMiddleware, createDevLogsMiddleware, createOpenapiMiddleware, evaluateTemplateLiteral, extractPageRouteInfo, getQuery, getQueryParam, handleDevProxyError, isRouteComponent, normalizeBasePath, parseAndGenerateNestResourceTemplate, parseApiRoutes, parseRoutesFromFile, postprocessDrizzleSchema, registerMiddlewares, routeParserLog, sendError, sendJson, sendSuccess };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import { RequestHandler, Router, Application } from 'express';
|
|
3
|
+
import * as t from '@babel/types';
|
|
3
4
|
import { IncomingMessage as IncomingMessage$1, ServerResponse as ServerResponse$1 } from 'http';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -280,4 +281,30 @@ declare function getQueryParam(req: AnyRequest, key: string): string | undefined
|
|
|
280
281
|
*/
|
|
281
282
|
declare function registerMiddlewares(server: ExpressApp | ViteMiddleware, middlewares: Middleware[], options?: Partial<MiddlewareContext>): Promise<void>;
|
|
282
283
|
|
|
283
|
-
|
|
284
|
+
interface PageRouteInfo {
|
|
285
|
+
path?: string;
|
|
286
|
+
index?: boolean;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface ParseRoutesOptions {
|
|
290
|
+
/** If true, prefix all routes with basePath. Default: true */
|
|
291
|
+
applyBasePath?: boolean;
|
|
292
|
+
}
|
|
293
|
+
declare function routeParserLog(level: 'log' | 'warn' | 'error' | 'info', message: string, ...args: unknown[]): void;
|
|
294
|
+
declare function calculateFileHash(filePath: string): string | null;
|
|
295
|
+
declare function isRouteComponent(openingElement: t.JSXOpeningElement): boolean;
|
|
296
|
+
declare function evaluateTemplateLiteral(templateLiteral: t.TemplateLiteral): string;
|
|
297
|
+
declare function extractPageRouteInfo(openingElement: t.JSXOpeningElement): PageRouteInfo;
|
|
298
|
+
declare function buildFullPath(routeStack: PageRouteInfo[], currentRoute: PageRouteInfo): string | null;
|
|
299
|
+
/**
|
|
300
|
+
* Parse routes from the app file at build time.
|
|
301
|
+
* @param appPath - Path to app.tsx (relative to cwd or absolute)
|
|
302
|
+
* @param basePath - Normalized base path prefix (e.g., '/my_plugin', or '' for no prefix)
|
|
303
|
+
* @param options - Parse options
|
|
304
|
+
* @returns Array of route definitions
|
|
305
|
+
*/
|
|
306
|
+
declare function parseRoutesFromFile(appPath: string, basePath: string, options?: ParseRoutesOptions): Array<{
|
|
307
|
+
path: string;
|
|
308
|
+
}>;
|
|
309
|
+
|
|
310
|
+
export { type GlobalMiddleware, type Middleware, type MiddlewareContext, type Options, type PageRouteInfo, type ParseRoutesOptions, type RouteInfo, type RouteMiddleware, buildFullPath, calculateFileHash, createCollectLogsMiddleware, createDevLogsMiddleware, createOpenapiMiddleware, evaluateTemplateLiteral, extractPageRouteInfo, getQuery, getQueryParam, handleDevProxyError, isRouteComponent, normalizeBasePath, parseAndGenerateNestResourceTemplate, parseApiRoutes, parseRoutesFromFile, postprocessDrizzleSchema, registerMiddlewares, routeParserLog, sendError, sendJson, sendSuccess };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,15 @@ import {
|
|
|
3
3
|
parseApiRoutes,
|
|
4
4
|
transformOpenapiPaths
|
|
5
5
|
} from "./chunk-LSHFHCDF.js";
|
|
6
|
+
import {
|
|
7
|
+
buildFullPath,
|
|
8
|
+
calculateFileHash,
|
|
9
|
+
evaluateTemplateLiteral,
|
|
10
|
+
extractPageRouteInfo,
|
|
11
|
+
isRouteComponent,
|
|
12
|
+
parseRoutesFromFile,
|
|
13
|
+
routeParserLog
|
|
14
|
+
} from "./chunk-YPNLFWHQ.js";
|
|
6
15
|
import {
|
|
7
16
|
__name
|
|
8
17
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -3528,17 +3537,24 @@ async function registerMiddlewares(server, middlewares, options) {
|
|
|
3528
3537
|
}
|
|
3529
3538
|
__name(registerMiddlewares, "registerMiddlewares");
|
|
3530
3539
|
export {
|
|
3540
|
+
buildFullPath,
|
|
3541
|
+
calculateFileHash,
|
|
3531
3542
|
createCollectLogsMiddleware,
|
|
3532
3543
|
createDevLogsMiddleware,
|
|
3533
3544
|
createOpenapiMiddleware,
|
|
3545
|
+
evaluateTemplateLiteral,
|
|
3546
|
+
extractPageRouteInfo,
|
|
3534
3547
|
getQuery,
|
|
3535
3548
|
getQueryParam,
|
|
3536
3549
|
handleDevProxyError,
|
|
3550
|
+
isRouteComponent,
|
|
3537
3551
|
normalizeBasePath,
|
|
3538
3552
|
parseAndGenerateNestResourceTemplate,
|
|
3539
3553
|
parseApiRoutes,
|
|
3554
|
+
parseRoutesFromFile,
|
|
3540
3555
|
postprocessDrizzleSchema,
|
|
3541
3556
|
registerMiddlewares,
|
|
3557
|
+
routeParserLog,
|
|
3542
3558
|
sendError,
|
|
3543
3559
|
sendJson,
|
|
3544
3560
|
sendSuccess
|